How to use the artifact located in local .m2 repository instead of looking in nexus?

360 Views Asked by At

I have an artifact in the form of an WAR file which i want to store in my local .m2 repository. This WAR file is NOT yet present elsewhere i.e in any other URL repository like nexus etc.

C:\Users\user1.m2\repository\com\mycompany\prodcode\myapp\2.3.1423\myapp-2.3.1423-test.war

Now when i run my POM using mvn then i want the WAR artifact i copied above to be used AND DO NOT maven to go and search the repositories (like nexus etc).

How can i do the same?

I have made following POM file changes but they don't seem to work. Is there anything i need to do so that artifact i copied is the one used by the Maven build system?

<build>
    <directory>${project.basedir}/target</directory>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <id>download-dependencies</id>
                    <goals>
                        <goal>unpack</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>com.mycompany.prodcode</groupId> 
                                <artifactId>myapp</artifactId>
                                <version>2.3.1423</version>
                                <classifier>test</classifier>
                                <type>war</type>
                                <includes>**/*.*</includes>
                                <outputDirectory>${master.dir}/myapp</outputDirectory>
                                <overWrite>true</overWrite>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
 </build>
0

There are 0 best solutions below