Assume I have the jar under the target folder: Is there any option in maven to install into local repository jar without executing previous phases (compile, package)?
Asked
Active
Viewed 1.3k times
8
-
More info about this and the error "the packaging for this project did not assign a file to the build artifact" in: [Maven: The packaging for this project did not assign a file to the build artifact](http://stackoverflow.com/questions/6308162/maven-the-packaging-for-this-project-did-not-assign-a-file-to-the-build-artifac) – bott Jan 24 '17 at 10:12
2 Answers
14
Simply do mvn install:install
instead of mvn install
.

Michael-O
- 18,123
- 6
- 55
- 121
-
-
5
-
2Doesn't work - `The packaging for this project did not assign a file to the build artifact` error. – parsecer Aug 14 '19 at 16:54
-
That's correct because you run a goal, not a phase. the file is unknown to the build reactor. – Michael-O Aug 14 '19 at 16:58
-
4See [this other answer](https://stackoverflow.com/a/38148135/543699) if you need to install the artifact without rebuilding. TLDR; use: `mvn validate jar:jar install:install`. It runs three (quick) phases, and does _not_ rebuild. – MikeG Apr 23 '20 at 17:13
6
Taken form the documentation:
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
you need to run this once for the pom and once for the jar.

Augusto
- 28,839
- 5
- 58
- 88
-
1There is no need to do so if this is a project created file not 3rd party. – Michael-O Aug 22 '11 at 18:34