Mavenの使い方
eclipseとmavenを使用した開発が便利なのはわかるがやり方と考え方が。。。
調べたのでまとめておく
参考サイト:https://maven.apache.org/pom.html
1.mvn install コマンド
・pox.xmlに定義したライブラリをローカルリポジトリ(Mavenリポジトリ)
にインストール→開発プロジェクトから参照できるようになる
*自分の作成するものに関しては全角表示
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>アーティファクトID</artifactId>
<version>バージョン</version>
<packaging>出力するファイル形式(war, earなど)</packaging>
<description>説明書き</description>
<dependencies>
<!-- 追加したいライブラリ -->
<groupId>対象のライブラリグループID</groupId>
<artifactId>アーティファクトID</artifactId>
<version>バージョン</version>
</dependency>
</dependencies>
<repositories>
<!-- 参照するライブラリをインストールするリモートリポジトリ -->
<repository>
<!-- Primeface -->
<id>primefaces-repository</id>
<name>Primefaces repository</name>
<url>http://repository.primefaces.org</url>
</repository>
</repositories>
<!-- プラグイン -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
----------------------------------------------------------------------
2.mavenでのデプロイはdistributionManagementタグで追加
<
distributionManagement
>
<
repository
>
<
id
>deploy-repository</
id
>
<
name
>deployRepository</
name
>
</
repository
>
</
distributionManagement
>
ここまで来て、エラーが解消できなかったが。。。
「Could not find artifact....」とのエラーは
<projectタグ直下の<argifactId>を修正し、faces-config.pagefllowファイルのcinfigfileの値を修正したら解消できました。