I am working on a basic maven project. This is what I get within the target
folder
This is the outputDirectory of my maven project and I know that there is a way to change the location of the war file being generated. The folder being selected in the above picture is exactly the same as the one being deployed to the webapps folder.
Now my doubt is Can I change the location of this file so that I can instruct maven to directly generate this folder inside my webapps
folder
I suppose the target you want to achieve is to copy your artifact to web-server deploy directory on build.
maven-resources-plugin can be used for that
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${tomcat_home}/webapps</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/eBuddy</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
Use this
<profiles>
<profile>
<id>myDirectory</id>
<build>
<directory>your-preffered-directory</directory>
</build>
</profile>
</profiles>
mvn compile -PmyDirectory
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.