My problem is that I want to have an external lib imported into the local maven repository of the user automatically.
Here is how I get it working using maven-install-plugin :
       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-install-plugin</artifactId>
            <version>2.5.2</version>
            <executions>
                <execution>
                    <id>install-external</id>
                    <phase>clean</phase>
                    <configuration>
                        <file>${basedir}/myjar.jar>
                        <repositoryLayout>default</repositoryLayout>
                        <groupId>mygroupid</groupId>
                        <artifactId>myartefactid</artifactId>
                        <version>myversion</version>
                        <packaging>jar</packaging>
                        <generatePom>true</generatePom>
                    </configuration>
                    <goals>
                        <goal>install-file</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
But with this in pom, in order to have it working I have to execute in two different commands :
mvn clean 
mvn install
If I am just runing
 mvn clean install
It's failling not resolving my dependency during the install phase (except if I have done a mvn clean alone and I havn't clean the local repository of course). Clean seems to call the pluging only if I run 'mvn clean' alone.
What I would like is to have my dependency automatically imported when runing 'mvn install'. Or at least while runing 'mvn clean install' in a single command.
 
     
    