maven plugin install:install-file error
java, maven
Solution
Since you have bound `install:install-file` goal to the `generate-sources` phase, you should run `mvn compile` or `mvn install` or such to use the defined configurations.
`mvn eclipse:eclipse` works because maven runs the `generate-sources` phase prior to invoking `eclipse:eclipse`.
Edit: From the comments it looks like you want to use the locally available `paho.jar` in your project by first installing it to your local repo in the `generate-sources` phase and thereafter use it as a `dependency` in your project.
This is not going to work since maven checks for availability of `dependencies` before it starts executing its life-cycle goals.
You could manually install it one-time using `mvn install:install-file` outside the context of the pom. Better still you could deploy it to a `repository manager` and then access it like any other dependency.
However, if you still want to go down this path, an alternate approach would be to specify the dependency with a `system` scope providing the path of the jar. Refer to this.
<project>
...
<dependencies>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>paho</artifactId>
<version>1.0.0/version>
<scope>system</scope>
<systemPath>${basedir}/lib/paho.jar</systemPath>
</dependency>
</dependencies>
...
</project>
Problem
I use install:install-file to install jar to my local repository.My pom.xml is written as follow: ``` <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-install-plugin</artifactId> <version>2.3.1</version> <executions> <execution> <id>install-paho</id> <phase>generate-resources</phase> <goals> <goal>install-file</goal> </goals> <configuration> <file>${basedir}/lib/paho.jar</file> <groupId>org.eclipse</groupId> <artifactId>paho</artifactId> <version>1.0.0</version> <packaging>jar</packaging> </configuration> </execution> </executions> </plugin> ``` You can find that I binding it to phase 'generate-resources'.And then,I use order `mvn eclipse:eclipse`.It works very well and the jar was copied to my local repository.But when I use order `mvn install:install-file` I got the error: ``` [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file (default-cli) on project xxx: The parameters 'file' for goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file are missing or invalid -> [Help 1] ``` The error messages when use `mvn compile` ``` [ERROR] Failed to execute goal on project android-engine: Could not resolve dependencies for project com.youku.wireless:android-engine:jar:1.0-SNAPSHOT: Could not find artifact org.eclipse:paho:jar:1.0.0 in spring-milestone (http://maven.springframework.org/milestone) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException ```