标题:
指定maven的目录路径(1)
[打印本页]
作者:
look_w
时间:
2019-4-19 20:30
标题:
指定maven的目录路径(1)
规范的maven项目路径为
myproject/
|-- pom.xml
`-- src
|-- main
| |-- java
| | `-- com
| | `-- mycompany
| |-- resources
| `-- webapp
| |-- WEB-INF
| | `-- web.xml
| `-- index.jsp
`-- test
|-- java
| `-- com
| `-- mycompany
`-- resources
如果我们的项目是非规范的maven项目,或者说我们想对maven项目的目录进行指定修改
可以用如下pom.xml
sourceDirectory目录涉及到 class中java的发布
warSourceDirectory涉及到 jsp的发布
如果没设置对,发布后的项目中就会有jsp或者.class文件缺失
<build>
<sourceDirectory>src/</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<directory>resource</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version>
<configuration>
<webXml>./WebRoot/WEB-INF/web.xml</webXml>
<warSourceDirectory>WebRoot</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.13</version>
<configuration>
<configLocation>resource/checkstyle_checks.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.2</version>
</plugin>
</plugins>
</build>
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/)
Powered by Discuz! 7.0.0