[英]Maven Target folder properties
I am working on a basic maven project. 我正在做一个基本的Maven项目。 This is what I get within the
target
folder 这就是我在
target
文件夹中得到的
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. 这是我的Maven项目的outputDirectory,我知道有一种方法可以更改正在生成的war文件的位置。 The folder being selected in the above picture is exactly the same as the one being deployed to the webapps folder.
上图中选择的文件夹与部署到webapps文件夹的文件夹完全相同。
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 现在我的疑问是我可以更改此文件的位置,以便指示Maven直接在我的
webapps
文件夹中生成此文件夹吗?
I suppose the target you want to achieve is to copy your artifact to web-server deploy directory on build. 我想您要实现的目标是将构件复制到构建时的Web服务器部署目录。
maven-resources-plugin can be used for that 可以使用maven-resources-plugin
<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 mvn编译-PmyDirectory
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.