いつもどこかでデスマーチ♪

不定期に、私の日常を書き込みしていきます。

Eclipse + Maven + SAStruts + Java8

2017年09月20日 22時37分46秒 | メモ
本記事の参照元:
http://a4dosanddos.hatenablog.com/entry/2015/05/26/015741

忘れた時(消えた時)用の超メモ


・Maven では、Pom.xml を使う
・Pom.xml に記載する内容は、ここから検索して使う
http://mvnrepository.com

Eclilpse(Pleiades All in One)からの使い方
1.「ファイル」→「新規」→「Maven プロジェクト」
2.「シンプルなプロジェクトの作成(S)」にチェックを付ける
 (他の2つは環境に合わせて変更する)通常はそのままにして、チェック2個状態で良い
3.グループID:適当
  アーティファクトID:プロジェクト名
  バージョン:適当
  パッケージ:開発する物に合わせる
4.完了ボタンを押下すると、Eclipse にプロジェクトが作成される
5.ルートディレクトリにあるPom.xml を開く (タブのpom.xmlを開く)

・SA-Struts用に下記を追加する
・保存すると勝手にライブラリのダウンロードからビルドまでしてくれる
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>maven.seasar.org</id>
            <name>The Seasar Foundation Maven Repository</name>
            <url>http://maven.seasar.org/maven2</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>maven-snapshot.seasar.org</id>
            <name>The Seasar Foundation Maven Snapshot Repository</name>
            <url>http://maven.seasar.org/maven2-snapshot</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.seasar.container</groupId>
            <artifactId>s2-framework</artifactId>
            <version>2.4.48</version>
            <exclusions>
                <exclusion>
                    <groupId>jboss</groupId>
                    <artifactId>javassist</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.seasar.container</groupId>
            <artifactId>s2-extension</artifactId>
            <version>2.4.48</version>
        </dependency>
        <dependency>
            <groupId>org.seasar.container</groupId>
            <artifactId>s2-tiger</artifactId>
            <version>2.4.48</version>
        </dependency>
        <dependency>
            <groupId>org.seasar.sastruts</groupId>
            <artifactId>sa-struts</artifactId>
            <version>1.0.4-sp9</version>
        </dependency>
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>javax.ejb</groupId>
            <artifactId>ejb-api</artifactId>
            <version>3.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.javassist/javassist -->
        <dependency>
            <groupId>org.javassist</groupId>
            <artifactId>javassist</artifactId>
            <version>3.21.0-GA</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/log4j/log4j -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
    </dependencies>



6.XMLファイルの配置
  SA-Struts 内に下記のファイルが有るので、コピーして持ってくる。(sa-struts-tutorial-1.0.4-sp9.zipファイルは、Seasar2のHPからDLしてください)
WEB-INF 直下
・struts-config.xml
・validator-rules.xml
・web.xml
src/main/resource
・app.dicon
・convention.dicon
・creator.dicon
・customizer.dicon
・jdbc.dicon
・log4j.properties
・s2container.dicon
等々


以上で動くはず…


因みに、POMに書けないjarを使う場合(http://mvnrepository.comに存在しないjarファイルを使う場合)
        <dependency>
            <groupId>com.pdfjet</groupId>
            <artifactId>PDFjet</artifactId>
            <version>1.0</version>
            <scope>system</scope>
            <systemPath>${basedir}/lib/PDFjet.jar</systemPath>
        </dependency>

みたいな感じで、pom.xml と同じ階層に「lib」フォルダを作っておけば良い



因みに、今回作ってるプロジェクトのPOM.xml全体はこれ
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>グループIDは何を設定するの</groupId>
<artifactId>プロジェクト名で良いんじゃない?</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>MonitorServer</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>maven.seasar.org</id>
<name>The Seasar Foundation Maven Repository</name>
<url>http://maven.seasar.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>maven-snapshot.seasar.org</id>
<name>The Seasar Foundation Maven Snapshot Repository</name>
<url>http://maven.seasar.org/maven2-snapshot</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.seasar.container</groupId>
<artifactId>s2-framework</artifactId>
<version>2.4.48</version>
<exclusions>
<exclusion>
<groupId>jboss</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.seasar.container</groupId>
<artifactId>s2-extension</artifactId>
<version>2.4.48</version>
</dependency>
<dependency>
<groupId>org.seasar.container</groupId>
<artifactId>s2-tiger</artifactId>
<version>2.4.48</version>
</dependency>
<dependency>
<groupId>org.seasar.sastruts</groupId>
<artifactId>sa-struts</artifactId>
<version>1.0.4-sp9</version>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.javassist/javassist -->
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.21.0-GA</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.persistence/org.eclipse.persistence.jpa -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.arnx/jsonic -->
<dependency>
<groupId>net.arnx</groupId>
<artifactId>jsonic</artifactId>
<version>1.3.10</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.0.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.opencsv/opencsv -->
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-excelant -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-excelant</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-scratchpad -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/taglibs/standard -->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency> <groupId>com.pdfjet</groupId> <artifactId>PDFjet</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>${basedir}/lib/PDFjet.jar</systemPath> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate.validator/hibernate-validator -->
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.2.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.codelibs/jcifs -->
<dependency>
<groupId>org.codelibs</groupId>
<artifactId>jcifs</artifactId>
<version>1.3.18.2</version>
</dependency>
</dependencies>
</project>

コメント    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« Entity Framework + Postgres... | トップ | Microsoft Skype v8 は無理で... »

コメントを投稿

ブログ作成者から承認されるまでコメントは反映されません。

メモ」カテゴリの最新記事