Maven - Install Local Dependencies during package phase

Viewed 17

I'm trying to add to my pom an Ant run task to install local dependencies before building the jar.

So i added in my pom this part

<plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>

                        <executions>
                        <execution>
                                <id>Install Local Dependencies</id>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <phase>validate</phase>
                                <configuration>
                                    <target>
                                    
                                        <echo message="Installing local lib" />
                                        <exec executable="/usr/local/bin/mvn">

                                            <arg value="-f ${lib.dir}/pom.xml clean install " />
                                             
                                        </exec>

                                    </target>
                                </configuration>
                            </execution>
                            
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.ant</groupId>
                                <artifactId>ant-jsch</artifactId>
                                <version>1.9.6</version>
                            </dependency>
                        </dependencies>
                    </plugin>

but it fails because it tries to launch mvn from the current directory.

Is there a proper way to install an external pom before building the main pom?

0 Answers
Related