Maven install failure: Install doesn't see packaged artifact

时间:2016-01-13 15:29:10

标签: maven maven-assembly-plugin maven-install-plugin

I have a Maven build failing during the install phase to a No such file or directory error, despite the fact that the file exists (and was created during package phase).

[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]

The filesystem confirms that /home/username/artifactname/sphinxsegmentation/target/artifactname-segmenter-0.0.1-SNAPSHOT-downstream-test-input.zip exists on the filesystem, and executing only through the package phase succeeds.

No plugins have been bound to the installation phase other than the default maven-install-plugin. artifactname-segmenter-0.0.1-SNAPSHOT-downstream-test-input.zip is being produced by a maven-assembly-plugin execution with the following 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>

Why is install failing to see the zip artifact? Thank you for any help.

1 个答案:

答案 0 :(得分:1)

问题出在{P}的build-helper-maven-plugin配置中,由于某种原因,该配置通过名称target/${project.name}-${project.version}-downstream-test-input.zip引用了工件。 <name>设置为artifactname-segmenter时,artifactId设置为artifactname-segmentation

检查您的配置,伙计们。