Java 5 +Struts 1.2 +Maven 2 +XDoclet で開発を行う際のプロジェクトひな形

 

方針

まずは、Maven で、Webアプリを作成する

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.sample.struts</groupId>
  <artifactId>StrutsSample</artifactId>
  <packaging>war</packaging>
  <name>StrutsSample Maven Webapp</name>
  <version>1.0-SNAPSHOT</version>
  <url>http://maven.apache.org</url>
  <build>
    <finalName>StrutsSample</finalName>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>sun.jdk</groupId>
            <artifactId>tools</artifactId>
            <version>1.5.0</version>
            <scope>system</scope>
            <systemPath>${env.JAVA_HOME}/lib/tools.jar
            </systemPath>
          </dependency>
          <dependency>
            <groupId>ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.6.5</version>
          </dependency>
        </dependencies>
        <executions>
          <execution>
            <phase>process-resources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <tasks>
                <ant antfile="build.xml" target="struts" inheritRefs="false" />
              </tasks>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <repository>
      <id>maven.seasar.org</id>
      <name>The Seasar Foundation Maven2 Repository</name>
      <url>http://maven.seasar.org/maven2</url>
    </repository>
    <repository>
      <id>maven2-repository.dev.java.net</id>
      <name>Java.net Maven 2 Repository</name>
      <url>http://download.java.net/maven/2</url>
    </repository>
    <repository>
      <id>maven-repository.dev.java.net</id>
      <name>Java.net Maven 1 Repository (legacy)</name>
      <url>http://download.java.net/maven/1</url>
      <layout>legacy</layout>
    </repository>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.3</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.seasar.dao</groupId>
      <artifactId>s2-dao</artifactId>
      <version>1.0.48</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>taglibs</groupId>
      <artifactId>standard</artifactId>
      <version>1.1.2</version>
    </dependency>
    <dependency>
      <groupId>struts</groupId>
      <artifactId>struts</artifactId>
      <version>1.2.9</version>
    </dependency>
    <dependency>
      <groupId>javax.transaction</groupId>
      <artifactId>jta</artifactId>
      <version>1.0.1B</version>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.1</version>
      <exclusions>
        <exclusion>
          <artifactId>servlet-api</artifactId>
          <groupId>javax.servlet</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
</project>

build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project default="struts" basedir=".">
  <property name="xdoclet.lib.dir"  value="xdoclet" />
  <property name="xdoclet.src.dir"  value="src/main/java" />
  <property name="xdoclet.dest.dir"  value="src/main/webapp/WEB-INF" />
  <property name="xdoclet.mearge.dir"  value="src/main/webapp/WEB-INF" />
  
  <path id="class.path">
    <!-- XDoclet -->
    <fileset dir="${xdoclet.lib.dir}">
      <include name="**/*.jar" />
    </fileset>
  </path>
  <target name="struts">
    <taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask" classpathref="class.path" />
    <webdoclet destdir="${xdoclet.dest.dir}" mergedir="${xdoclet.mearge.dir}"
      excludedtags="@version,@author,@todo" force="true" verbose="true">
      <fileset dir="${xdoclet.src.dir}">
        <include name="**/*.java" />
      </fileset>
      <strutsconfigxml version="1.2" />
      <strutsvalidationxml />
    </webdoclet>
  </target>
</project>

Java#Struts / Java Maven


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2008-11-24 (月) 17:22:44 (5865d)
Short-URL: http://at-sushi.com/pukiwiki/pukiwiki.php?cmd=s&k=f336159309
ISBN10
ISBN13
9784061426061