Index ソフト・ハード | Maven タスク |
機能・要件 構成・方式 動作 タスク 開発環境 プロジェクト作成 プロパティ・他 ビルドパスの構成 JREバージョン変更 ファセット設定 依存関係の変更 war作成 インストール |
新しい開発環境(Eclipse) ・マーケットプレイスから STS (3.9.5)インストール ・ヘルプ、STS 検索、ライセンスをレビューして受け入れ ・インストール ・警告、署名なしコンテンツを含む・・・(OK) ・再起動・Springパーステクティブを開く ・ウインドウ、パーステクティブを開く、その他、Spring、OKMavenプロジェクトの作成 ・新規、Mavenプロジェクト、シンプルなプロジェクト作成(アーキタイプ選択スキップ)はノーチェック ・ロケーションを指定、次へ ・アーキタイプの選択、フィルタ―に「maven-archetype-webapp」、「1.0」選択して次へ ・グループID:ルートパッケージ名、入力 ・アーティファクトID:プロジェクト名、入力、完了 ・欠落しているソースフォルダ(アーキタイプの選択の場合のバグ)の作成 ・手動で src/main/java、src/test/java、src/test/resources フォルダを作成プロパティ・他 ・プリジェクト・ファセット ・ビルドパスは、実行環境J2SE-1.5を指定している。(警告) ・1.8へ ・動的Webモジュールは2.3を指定している。 ・3.1へビルドパスの構成 ・ライブラリ ・Apache-Tomcat ・アンバウンドメッセージ(Eclipseエラー) ・JREシスイェムライブラリ ・MAVEN依存関係・順序及びエクスポート ・ソース ・MAVEN依存関係 ・Apache-Tomcat ・JREシスイェムライブラリJREのバージョン変更 ・ビルドパスは、実行環境j2se-1.5を指定している ・ビルドパス、ライブラリの追加、デフォルト(java8)選択 プロジェクト・ファセットの設定(プロジェクト固有の設定) ・「動的 Webモジュール」、バージョン「3.1」に ・「3.1」にできない場合 ・「.settings\org.eclipse.wst.common.project.facet.core.xml」を編集、再起動依存関係の変更(pom.xml編集(springframework使用)) ・Eclipse、設定、Maven、始動時にリポジトリー・インデックス更新をダウンロードをチェック、再起動 ・インデックス更新は時間要・依存ライブラリの設定(WebMVCライブラリ) ・プロジェクト右クリック、maven、依存関係の追加 ・グループID、org.springframework ・アーティファクト ID、spring-webmvc ・バージョン、選択する ・スコープ、Compilehttps://maven.apache.org/pom.html ・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>xxx.xxx</groupId>
<artifactId>xxx</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<org.springframework-version>4.3.2.RELEASE</org.springframework-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<dependencies>
<dependency> spring-test 参考
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency> spring-webmvc 参考
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency> servlet-api 参考
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency> spring-security-core 参考
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>4.1.3.RELEASE</version>
</dependency>
<dependency> spring-security-web 参考
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>4.1.3.RELEASE</version>
</dependency>
<dependency> spring-security-config 参考
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>4.1.3.RELEASE</version>
</dependency>
<dependency> commons-dbcp(DBCP) 参考
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<dependency> spring-jdbc(PostgreSQL) 参考
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework-version}</version>
</dependency>
<dependency> postgresql 参考
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901.jdbc4</version>
</dependency>
<dependency> jstl 参考
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
<dependency> hibernate-validator 参考
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.3.2.Final</version>
</dependency>
<dependency> slf4j-jcl 参考
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
<version>1.7.21</version>
</dependency>
<dependency> commons-fileupload 参考
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.2</version>
</dependency>
<dependency> commons-io 参考
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<dependency> log4j 参考
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>runtime</scope>
</dependency>
<!-- DBCP -->
<dependency> commons-dbcp 参考
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- PostgreSQL -->
<dependency> postgresql 参考
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1209.jre7</version>
</dependency>
</dependencies>
<build>
:
:
</build>
</project>
war作成 ・プロジェクト右クリック、コマンド・プロンプト >mvn package ・リフレッシュして表示確認・WARNING ・[WARNING] File encoding has not been set, using platform encoding MS932, i.e. build is platform dependent! ・[WARNING] Using platform encoding (MS932 actually) to copy filtered resources, i.e. build is platform dependent! ・pom.xmlに追加
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
・ビルド設定(pom.xml)
<build>
<finalName>sample</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<!-- war作成用 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>make-war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
<webResources>
<resource>
<directory>src/main/webapp</directory>
</resource>
</webResources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
|
All Rights Reserved. Copyright (C) ITCL |