Maven 安装失败:安装看不到打包的工件
Maven install failure: Install doesn't see packaged artifact
尽管文件存在(并且是在 package
阶段创建的),但我的 Maven 构建在 install
阶段失败并出现 No such file or directory
错误。
[INFO] --- maven-assembly-plugin:2.2-beta-5:single (lev-sys-test-output) @ artifactname-segmentation ---
[INFO] Building zip: /home/username/artifactname/sphinxsegmentation/target/artifactname-segmentation-0.0.1-SNAPSHOT-downstream-test-input.zip
[WARNING] Assembly file: /home/username/artifactname/sphinxsegmentation/target/artifactname-segmentation-0.0.1-SNAPSHOT-downstream-test-input.zip is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment.
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ artifactname-segmentation ---
[INFO] Installing /home/username/artifactname/sphinxsegmentation/target/artifactname-segmentation-0.0.1-SNAPSHOT.jar to /devel/asr/bin/m2repo/package/name/sphinxsegmentation/artifactname-segmentation/0.0.1-SNAPSHOT/artifactname-segmentation-0.0.1-SNAPSHOT.jar
[INFO] Installing /home/username/artifactname/sphinxsegmentation/pom.xml to /devel/asr/bin/m2repo/package/name/sphinxsegmentation/artifactname-segmentation/0.0.1-SNAPSHOT/artifactname-segmentation-0.0.1-SNAPSHOT.pom
[INFO] Installing /home/username/artifactname/sphinxsegmentation/target/artifactname-segmentation-0.0.1-SNAPSHOT-sources.jar to /devel/asr/bin/m2repo/package/name/sphinxsegmentation/artifactname-segmentation/0.0.1-SNAPSHOT/artifactname-segmentation-0.0.1-SNAPSHOT-sources.jar
[INFO] Installing /home/username/artifactname/sphinxsegmentation/target/artifactname-segmentation-0.0.1-SNAPSHOT-tests.jar to /devel/asr/bin/m2repo/package/name/sphinxsegmentation/artifactname-segmentation/0.0.1-SNAPSHOT/artifactname-segmentation-0.0.1-SNAPSHOT-tests.jar
[INFO] Installing /home/username/artifactname/sphinxsegmentation/target/artifactname-segmenter-0.0.1-SNAPSHOT-downstream-test-input.zip to /devel/asr/bin/m2repo/package/name/sphinxsegmentation/artifactname-segmentation/0.0.1-SNAPSHOT/artifactname-segmentation-0.0.1-SNAPSHOT-downstream-test-input.zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 41.992 s
[INFO] Finished at: 2016-01-13T10:13:42-05:00
[INFO] Final Memory: 41M/975M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project artifactname-segmentation: Failed to install artifact package.name.sphinxsegmentation:artifactname-segmentation:zip:downstream-test-input:0.0.1-SNAPSHOT: /home/username/artifactname/sphinxsegmentation/target/artifactname-segmenter-0.0.1-SNAPSHOT-downstream-test-input.zip (No such file or directory) -> [Help 1]
文件系统确认 /home/username/artifactname/sphinxsegmentation/target/artifactname-segmenter-0.0.1-SNAPSHOT-downstream-test-input.zip
存在于文件系统上,并且仅通过 package
阶段执行成功。
除默认的 maven-install-plugin 外,没有插件绑定到安装阶段。 artifactname-segmenter-0.0.1-SNAPSHOT-downstream-test-input.zip
由具有以下 descriptorRefs
:
的 maven-assembly-plugin 执行生成
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>downstream-test-input</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>./</directory>
<outputDirectory>./</outputDirectory>
<excludes>
<exclude>*/**</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${basedir}/target/mr-test-output</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>*/**/*.avro</include>
</includes>
</fileSet>
</fileSets>
</assembly>
为什么安装时看不到 zip 工件?感谢您的帮助。
问题出在 build-helper-maven-plugin
的父 POM 配置中,出于某种原因,它通过名称 target/${project.name}-${project.version}-downstream-test-input.zip
引用了工件。 <name>
设置为 artifactname-segmenter
而 artifactId
设置为 artifactname-segmentation
。
检查您的配置,伙计们。
尽管文件存在(并且是在 package
阶段创建的),但我的 Maven 构建在 install
阶段失败并出现 No such file or directory
错误。
[INFO] --- maven-assembly-plugin:2.2-beta-5:single (lev-sys-test-output) @ artifactname-segmentation ---
[INFO] Building zip: /home/username/artifactname/sphinxsegmentation/target/artifactname-segmentation-0.0.1-SNAPSHOT-downstream-test-input.zip
[WARNING] Assembly file: /home/username/artifactname/sphinxsegmentation/target/artifactname-segmentation-0.0.1-SNAPSHOT-downstream-test-input.zip is not a regular file (it may be a directory). It cannot be attached to the project build for installation or deployment.
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ artifactname-segmentation ---
[INFO] Installing /home/username/artifactname/sphinxsegmentation/target/artifactname-segmentation-0.0.1-SNAPSHOT.jar to /devel/asr/bin/m2repo/package/name/sphinxsegmentation/artifactname-segmentation/0.0.1-SNAPSHOT/artifactname-segmentation-0.0.1-SNAPSHOT.jar
[INFO] Installing /home/username/artifactname/sphinxsegmentation/pom.xml to /devel/asr/bin/m2repo/package/name/sphinxsegmentation/artifactname-segmentation/0.0.1-SNAPSHOT/artifactname-segmentation-0.0.1-SNAPSHOT.pom
[INFO] Installing /home/username/artifactname/sphinxsegmentation/target/artifactname-segmentation-0.0.1-SNAPSHOT-sources.jar to /devel/asr/bin/m2repo/package/name/sphinxsegmentation/artifactname-segmentation/0.0.1-SNAPSHOT/artifactname-segmentation-0.0.1-SNAPSHOT-sources.jar
[INFO] Installing /home/username/artifactname/sphinxsegmentation/target/artifactname-segmentation-0.0.1-SNAPSHOT-tests.jar to /devel/asr/bin/m2repo/package/name/sphinxsegmentation/artifactname-segmentation/0.0.1-SNAPSHOT/artifactname-segmentation-0.0.1-SNAPSHOT-tests.jar
[INFO] Installing /home/username/artifactname/sphinxsegmentation/target/artifactname-segmenter-0.0.1-SNAPSHOT-downstream-test-input.zip to /devel/asr/bin/m2repo/package/name/sphinxsegmentation/artifactname-segmentation/0.0.1-SNAPSHOT/artifactname-segmentation-0.0.1-SNAPSHOT-downstream-test-input.zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 41.992 s
[INFO] Finished at: 2016-01-13T10:13:42-05:00
[INFO] Final Memory: 41M/975M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project artifactname-segmentation: Failed to install artifact package.name.sphinxsegmentation:artifactname-segmentation:zip:downstream-test-input:0.0.1-SNAPSHOT: /home/username/artifactname/sphinxsegmentation/target/artifactname-segmenter-0.0.1-SNAPSHOT-downstream-test-input.zip (No such file or directory) -> [Help 1]
文件系统确认 /home/username/artifactname/sphinxsegmentation/target/artifactname-segmenter-0.0.1-SNAPSHOT-downstream-test-input.zip
存在于文件系统上,并且仅通过 package
阶段执行成功。
除默认的 maven-install-plugin 外,没有插件绑定到安装阶段。 artifactname-segmenter-0.0.1-SNAPSHOT-downstream-test-input.zip
由具有以下 descriptorRefs
:
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>downstream-test-input</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>./</directory>
<outputDirectory>./</outputDirectory>
<excludes>
<exclude>*/**</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>${basedir}/target/mr-test-output</directory>
<outputDirectory>./</outputDirectory>
<includes>
<include>*/**/*.avro</include>
</includes>
</fileSet>
</fileSets>
</assembly>
为什么安装时看不到 zip 工件?感谢您的帮助。
问题出在 build-helper-maven-plugin
的父 POM 配置中,出于某种原因,它通过名称 target/${project.name}-${project.version}-downstream-test-input.zip
引用了工件。 <name>
设置为 artifactname-segmenter
而 artifactId
设置为 artifactname-segmentation
。
检查您的配置,伙计们。