I'm using Maven 3.0.3 on Mac 10.6.6. I have a JAR project and when I run the command "mvn clean install:install", I'm getting the error,
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-cli) on project StarTeamCollisionUtil: The packaging for this project did not assign a file to the build artifact -> [Help 1]
What does this mean and how can I fix it? Below is my pom.xml. Let me know what other info would be helpful and I'll edit this post. Thanks, - Dave
<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>com.myco.starteam.util</groupId>
<artifactId>StarTeamCollisionUtil</artifactId>
<packaging>jar</packaging>
<name>StarTeam Collision Util</name>
<description>
The StarTeam Collision Utility provides developers and release engineers alike the ability to
compare files attached to a set of CRs to see if conflicts exist in the change set.
</description>
<version>1.0-SNAPSHOT</version>
<url>http://cm-build.myco.com:8080/hudson/view/Tools/job/StarTeamCollisionUtil - TRUNK/</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>myco-sonatype-nexus-snapshots</id>
<name>MyCo Sonatype-Nexus Snapshots</name>
<url>http://sonatype.myco.com/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>starteam</groupId>
<artifactId>starteam</artifactId>
<version>1.1.0</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${basedir}/lib/starteam110.jar</systemPath>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<linksource>true</linksource>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>1.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.3.1</version>
<reportSets>
<reportSet>
<reports>
<report>index</report>
<report>dependencies</report>
<report>dependency-management</report>
<report>cim</report>
<report>issue-tracking</report>
<report>license</report>
<report>scm</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>sonatype-nexus</id>
<url>http://sonatype.myco.com/nexus/content/repositories/snapshots/</url>
</repository>
</distributionManagement>
<scm>
<url>https://starteam.cmass.myco.com/BorlandStarTeam/BorlandStarTeam.jsp</url>
</scm>
<issueManagement>
<system>StarTeam</system>
<url>https://starteam.cmass.myco.com/BorlandStarTeam/BorlandStarTeam.jsp</url>
</issueManagement>
<ciManagement>
<system>Hudson</system>
<url>http://cm-build.myco.com:8080/hudson/</url>
</ciManagement>
</project>
I have same issue. Error message for me is not complete. But in my case, I've added generation jar with sources. By placing this code in pom.xml:
So in deploy phase I execute source:jar goal which produces jar with sources. And deploy ends with BUILD SUCCESS
you must clear the target file such as in jar and others In C: drive your folder at .m2 see the location where it install and delete the .jar file,Snaphot file and delete target files then clean the application you found it will be run
I don't know if this is the answer or not but it might lead you in the right direction...
The command
install:install
is actually a goal on the maven-install-plugin. This is different than theinstall
maven lifecycle phase.Maven lifecycle phases are steps in a build which certain plugins can bind themselves to. Many different goals from different plugins may execute when you invoke a single lifecycle phase.
What this boils down to is the command...
is different from...
The former will run all goals in every cycle leading up to and including the install (like compile, package, test, etc.). The latter will not even compile or package your code, it will just run that one goal. This kinda makes sense, looking at the exception; it talks about:
Try the former and your error might just go away!
This reply is on a very old question to help others facing this issue.
I face this failed error while I were working on my
Java
project usingIntelliJ IDEA
IDE.this failed happens, when I choose
install:install
underPlugins - install
, as pointed with red arrow in below image.Once I run the selected
install
underLifecycle
as illustrated above, the issue gone, and my maven install compile build successfully.TL;DR To fix this issue, invoke packaging plugin before, e.g. for
jar
packaging usemaven-jar-plugin
, as following:Or
If you actually needed to deploy.
Gotcha This approach won't work if you have multi-module project with different packagings (ear/war/jar/zip) – even worse, wrong artifacts will be installed/deployed! In such case use reactor options to only build the deployable module (e.g. the
war
).Explanation
In some cases you actually want to run directly a
install:install
ordeploy:deploy
goal (that is, from themaven-deploy-plugin
, thedeploy
goal, not the Mavendeploy
phase) and you would end up in the annoyingThe packaging for this project did not assign a file to the build artifact
.A classic example is a CI job (a Jenkins or Bamboo job, e.g.) where in different steps you want to execute/care about different aspects:
mvn clean install
, performing tests and test coveragemvn sonar:sonar
plus further optionsmvn deploy
, because it would again execute previous phases (and compile, test, etc.) and you want your build to be effective but yet fast.Yes, you could speed up this last step at least skipping tests (compilation and execution, via
-Dmaven.test.skip=true
) or play with a particular profile (to skip as many plugins as possible), but it is much easier and clear to simply runmvn deploy:deploy
then.But it would fail with the error above, because as also specified by the plugin FAQ:
Indeed, the
deploy:deploy
needs some runtime information placed in the build context by previous phases (or previous plugins/goals executions).It has also reported as a potential bug:
MDEPLOY-158
: deploy:deploy does not work for only Deploying artifact to Maven Remote repoBut then rejected as not a problem.
The
deployAtEnd
configuration option of themaven-deploy-plugin
won't help neither in certain scenarios because we have intermediate job steps to execute:So, how to fix it?
Simply run the following in such a similar third/last step:
The
maven-jar-plugin
will not re-create any jar as part of your build, thanks to itsforceCreation
option set tofalse
by default:But it will nicely populate the build context for us and make
deploy:deploy
happy. No tests to skip, no profiles to add. Just what you need: speed.Additional note: if you are using the
build-helper-maven-plugin
,buildnumber-maven-plugin
or any other similar plugin to generate meta-data later on used by themaven-jar-plugin
(e.g. entries for the Manifest file), you most probably have executions linked to thevalidate
phase and you still want to have them during thejar:jar
build step (and yet keep a fast execution). In this case the almost harmless overhead is to invoke thevalidate
phase as following:Yet another additional note: if you have not
jar
but, say,war
packaging, usewar:war
before install/deploy instead.Gotcha as pointed out above, check behavior in multi module projects.