Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven deploy: The packaging for this project did not assign a file to the build artifact

Tags:

maven

I'm trying to deploy a maven project to a remote repository.

mvn install works just fine for local repository.

I'm using Groovy and the Groovy-Eclipse compiler plugin. I tried to run mvn deploy to deploy to a remote repository and I got the following error:

The packaging for this project did not assign a file to the build artifact -> [Help 1]

This is my pom.xml:

<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>io.github.notacariocafacil</groupId>
    <artifactId>notacariocafacil</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>


    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
        </dependency>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>1.8.6</version>
        </dependency>
    </dependencies>

    <build>
        <extensions>
            <extension>
                <groupId>org.kuali.maven.wagons</groupId>
                <artifactId>maven-s3-wagon</artifactId>
                <version>1.2.1</version>
            </extension>
        </extensions>
        <plugins>
          <plugin>
             <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                   <compilerId>groovy-eclipse-compiler</compilerId>
                   <source>1.6</source>
                    <target>1.6</target>
                </configuration>
                <dependencies>
                    <dependency>
                       <groupId>org.codehaus.groovy</groupId>
                       <artifactId>groovy-eclipse-batch</artifactId>
                       <version>1.8.6-01</version>
                    </dependency>
                    <dependency>
                        <groupId>org.codehaus.groovy</groupId>
                       <artifactId>groovy-eclipse-compiler</artifactId>
                        <version>2.7.0-01</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.codehaus.groovy</groupId>
                <artifactId>groovy-eclipse-compiler</artifactId>
                <version>2.7.0-01</version>
                <extensions>true</extensions>
             </plugin>
        </plugins>
    </build>
</project>

Do I need to add something in the build step?

like image 911
Bianca Rosa Avatar asked Nov 25 '15 20:11

Bianca Rosa


People also ask

What is Maven packaging?

Overview. The packaging type is an important aspect of any Maven project. It specifies the type of artifact the project produces. Generally, a build produces a jar, war, pom, or other executable. Maven offers many default packaging types and also provides the flexibility to define a custom one.

What does Mvn clean deploy do?

clean : removes files generated at build-time in a project's directory ( target by default) install : installs the package into the local repository, for use as a dependency in other projects locally.

How does maven deploy work?

deploy:deploy is used to automatically install the artifact, its pom and the attached artifacts produced by a particular project. Most if not all of the information related to the deployment is stored in the project's pom. deploy:deploy-file is used to install a single artifact along with its pom.

What is Maven install plugin?

The Install Plugin is used during the install phase to add artifact(s) to the local repository. The Install Plugin uses the information in the POM (groupId, artifactId, version) to determine the proper location for the artifact within the local repository.


1 Answers

You need to run mvn deploy instead of mvn deploy:deploy. The former executes the maven lifecycle up to the "deploy" phase, i.e. it compiles your code, packages it into a JAR file and finally deploys it to your remote repository.

mvn deploy:deploy on the other hand does only execute the deploy goal of the maven-deploy-plugin. Without the context of the previously executed lifecycle phases, which produce your actual build artifact (the JAR file), the maven-deploy-plugin does not have anything to deploy and aborts with the error The packaging for this project did not assign a file to the build artifact. This behavior is also explained in the FAQ of the maven-deploy-plugin.

like image 198
Stefan Ferstl Avatar answered Sep 19 '22 11:09

Stefan Ferstl