WAR (Tomcat で実行される REST Web サービス) を構築する Maven プロジェクトがあります。私が持っているpom.xmlで
<packaging>war</packaging>
一部のクラスは、別の別のプロジェクトで使用されています。これらのクラスは、次のように構成されたmaven-jar-pluginを使用して構築します。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<finalName>models</finalName>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
<includes>
<include>com/initech/middleware/application/conversion/*</include>
<include>com/initech/middleware/error/*</include>
<!-- other includes removed for example brevity -->
</includes>
<excludes>
<!-- removed for example brevity -->
</excludes>
</configuration>
<executions>
<execution>
<id>make-a-jar</id>
<phase>prepare-package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
現在、pom.xmlの「packaging」オプションを手動で「war」から「jar」に変更して実行することにより、JARファイルを作成します
mvn install
これにより、JAR ファイルが作成され、ローカル リポジトリにインストールされます。ただし、JAR ファイルをビルドする前に毎回 pom.xml ファイルを手動で編集することなく、これを行いたいと考えています。オプション「-Dpackaging=jar」を使用してみましたが、これは役に立ちませんでした。
コマンドラインでmavenを実行するだけで、maven-jar-pluginで構成されたJARファイルを作成できますか?