アセンブリプラグインでこれを行うことを理解していますが、多くの記述子を試しましたが、動作していません。エラーメッセージの意味を理解できませんでした。mavenビルドjarとマルチモジュールプロジェクトの依存関係
プロジェクト・アーキテクチャ:STIがアグリゲータプロジェクトである
---sti (parent project containing a pom.xml)
-----sti-any23
-----sti-common-util
-----sti-kbsearch
-----sti-websearch
-----sti-main
。モジュールsti-mainは、他のすべての4つのモジュールによって異なります。
は、親プロジェクトのpom.xmlは、次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<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>....</groupId>
<artifactId>sti</artifactId>
<version>1.0alpha</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven-install-plugin.version>2.5.2</maven-install-plugin.version>
<maven-compiler-plugin.version>3.5.1</maven-compiler-plugin.version>
<maven-source-plugin.version>2.2.1</maven-source-plugin.version>
<exec-maven-plugin.version>1.4.0</exec-maven-plugin.version>
<maven-shade-plugin.version>2.3</maven-shade-plugin.version>
</properties>
<modules>
<module>sti-any23</module>
<module>sti-common-util</module>
<module>sti-kbsearch</module>
<module>sti-websearch</module>
<module>sti-main</module>
</modules>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven-source-plugin.version}</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<configuration>
<mainClass/>
</configuration>
</plugin>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.4</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>config/maven-assembly/module.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
記述子は、 '設定/ mavenのアセンブリは、/ module.xml' は次のようになります。
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
<!-- TODO: a jarjar format would be better -->
<id>alljars</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<outputDirectory>/</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<unpack>true</unpack>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
私が取得エラー:
[WARNING] Cannot include project artifact: uk.ac.shef.dcs:sti:pom:1.0alpha; it doesn't have an associated file or directory.
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] sti-any23 .......................................... SUCCESS [ 1.709 s]
[INFO] sti-common-util .................................... SUCCESS [ 0.728 s]
[INFO] sti-kbsearch ....................................... SUCCESS [ 1.213 s]
[INFO] sti-websearch ...................................... SUCCESS [ 0.433 s]
[INFO] sti-main ........................................... SUCCESS [ 2.855 s]
[INFO] sti ................................................ FAILURE [ 0.389 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.839 s
[INFO] Finished at: 2016-07-26T19:50:53+01:00
[INFO] Final Memory: 75M/505M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5.4:single (make-assembly) on project sti: Failed to create assembly: Error creating assembly archive alljars: You must set at least one file. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :sti
私はまた、他の多くのディスクリプタをstackoverflowで見つけましたが、どちらも機能しませんでした。私はいくつかの基本的な概念が間違っているに違いないと思うが、それは分からない。
お願いします。ありがとう
はい。あるいは、アセンブリを作成することを目標とする新しいモジュールを用意することさえできます。親からの 'maven-assembly-plugin'を使って[モジュールバイナリ]をアセンブルすることができます(http://maven.apache.org/plugins/maven-assembly-plugin/examples/multimodule/module-binary-inclusion- simple.html)でも、既存のモジュールや専用のモジュールの中でこれを行うことを明らかにしたいと思います。 – Tunaki
ありがとうございます。私は、 'JAR' に削除 'モジュール' ブロック 'packaing' を変更し、ブロックを追加 ' uk.ac.shef.dcs STI-メイン 1.0alpha '。それはトリックをやっているようだ。これは正しいです? –
Ziqi
@Tunakiに同意します私はまた、作業を行う専用モジュールを好むでしょう。 –