私はmavenを使用してスタンドアロンのJavaアプリケーションを作成しており、次のようにmaven-dependecy-pluginを使用してjarファイルに依存関係を含めています。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>theMainClass</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>create-my-bundle</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
これには、libフォルダーに生成されたjarファイルの依存関係が含まれ、jarは正常に実行および動作しますが、問題は他の生成されたjarファイルにありますappname-1.0-jar-with-dependencies.jar
。
問題:問題appname-1.0-jar-with-dependencies.jar
かどうかはわかりませんが、生成されたターゲットフォルダーに、次のような重複するアプリケーションファイルが含まれていることに気付きました。
- すべてのsql、property files、xmlファイルは2回存在します。
- すべてのJavaクラスの.classファイルは2回存在します。
- 依存関係に関連するoverview.htmlファイルとlicense.txtファイルがたくさんあります。
私はそれが正しいと感じるかどうかわかりません。また、私はこのプラグインに精通していないので、この生成されたjarファイルの重要性を明確にする誰かが必要です。
アドバイスしてください、ありがとう。