我有多个项目。模块之一是程序集,具有将核心(库)和示例放在一个 zip 中的描述符。
<assembly>
<id>assembly</id>
<formats>
<format>zip</format>
<format>dir</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<useTransitiveDependencies>false</useTransitiveDependencies>
<outputDirectory>/</outputDirectory>
</dependencySet>
</dependencySets>
这是我的程序集,这是插件配置
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>package-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
我已经在我的 .m2 文件夹中安装了生成的 zip,但名称是 assembly-ccp-.... 我需要将其重命名为 my-project,它可以通过插件中的 2 行来完成:
<finalName>my-project</finalName>
<appendAssemblyId>false</appendAssemblyId>
它在目标文件夹中很好(我可以看到 my-project.zip),但现在生成的 zip 没有安装在我的 .m2 文件夹中。那么,问题是如何让它安装在我的 .m2 文件夹中?(从父项目运行:全新安装)
找到的输出:
[INFO] Building Assebly
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory /home/dmitry/mbus/trunk/assembly/target
[INFO] [site:attach-descriptor {execution: default-attach-descriptor}]
[INFO] Preparing source:jar
[WARNING] Removing: jar from forked lifecycle, to prevent recursive invocation.
[INFO] No goals needed for project - skipping
[INFO] [source:jar {execution: default}]
[INFO] [assembly:single {execution: package-assembly}]
[INFO] Reading assembly descriptor: assembly.xml
[INFO] Processing DependencySet (output=/)
[WARNING] Cannot include project artifact: com.comcast.xcal.mbus:assembly:pom:CCP-LATEST-SNAPSHOT; it doesn't have an associated file or directory.
[INFO] Building zip: /home/dmitry/mbus/trunk/assembly/target/my-project.zip
[WARNING] Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing.
Instead of attaching the assembly file: /home/dmitry/mbus/trunk/assembly/target/my-project.zip, it will become the file for main project artifact.
NOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!
[INFO] Processing DependencySet (output=/)
[INFO] Copying files to /home/dmitry/mbus/trunk/assembly/target/my-project.dir
[WARNING] Assembly file: /home/dmitry/mbus/trunk/assembly/target/my-project.dir is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment.
[INFO] [install:install {execution: default-install}]
[INFO] Installing /home/dmitry/mbus/trunk/assembly/pom.xml to /home/dmitry/.m2/repository/com/mbus/assembly/CCP-LATEST-SNAPSHOT/assembly-CCP-LATEST-SNAPSHOT.pom
[INFO] [javadoc:jar {execution: default}]
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO]