我正在使用Maven 3.3.3。我有一个包含大量静态资产的WAR项目。经常在构建我的WAR项目时(使用“mvn clean install”),即使只有Java文件发生了变化,项目也需要花费15分钟来构建。下面是我的WAR插件配置。有没有办法加快文件的构建?我正在使用“in = place”和“useCache”选项,但无济于事......
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<useCache>true</useCache>
<workDirectory>${user.home}/${project.artifactId}/war/work</workDirectory>
</configuration>
<executions>
<execution>
<id>default-war</id>
<phase>verify</phase>
</execution>
<execution>
<id>war-inplace</id>
<phase>package</phase>
<goals>
<goal>inplace</goal>
</goals>
</execution>
</executions>
</plugin>
这是Maven WAR插件的输出,如果这可以让我们深入了解如何加快速度
[INFO] --- maven-war-plugin:2.6:war (default-war) @ myproject ---
[INFO] Packaging webapp
[INFO] Assembling webapp [myproject] in [/home/Dropbox/sb_workspace/myproject/target/myproject]
[INFO] Dependency [Dependency {groupId=org.mainco.subco, artifactId=orders, version=84.0.0-SNAPSHOT, type=jar}] has changed (was Dependency {groupId=org.mainco.subco, artifactId=orders, version=84.0.0-SNAPSHOT, type=jar}).
[WARNING] File to remove [/home/Dropbox/sb_workspace/myproject/target/myproject/WEB-INF/lib/orders-84.0.0-SNAPSHOT.jar] has not been found
[INFO] Dependency [Dependency {groupId=org.springframework, artifactId=spring-core, version=3.2.11.RELEASE, type=jar}] has changed (was Dependency {groupId=org.springframework, artifactId=spring-core, version=3.2.11.RELEASE, type=jar}).
[WARNING] File to remove [/home/Dropbox/sb_workspace/myproject/target/myproject/WEB-INF/lib/spring-core-3.2.11.RELEASE.jar] has not been found
[INFO] Dependency [Dependency {groupId=org.springframework.security.extensions, artifactId=spring-security-saml2-core, version=1.0.0.RC2, type=jar}] has changed (was Dependency {groupId=org.springframework.security.extensions, artifactId=spring-security-saml2-core, version=1.0.0.RC2, type=jar}).
[WARNING] File to remove [/home/Dropbox/sb_workspace/myproject/target/myproject/WEB-INF/lib/spring-security-saml2-core-1.0.0.RC2.jar] has not been found
[INFO] Dependency [Dependency {groupId=org.opensaml, artifactId=opensaml, version=2.6.1, type=jar}] has changed (was Dependency {groupId=org.opensaml, artifactId=opensaml, version=2.6.1, type=jar}).
[WARNING] File to remove [/home/Dropbox/sb_workspace/myproject/target/myproject/WEB-INF/lib/opensaml-2.6.1.jar] has not been found
[INFO] Processing war project
[INFO] Copying webapp resources [/home/Dropbox/sb_workspace/myproject/src/main/webapp]
[INFO] Webapp assembled in [719348 msecs]
[INFO] Building war: /home/Dropbox/sb_workspace/myproject/target/myproject.war
答案 0 :(得分:1)
假设您的${user.home}
位于本地磁盘上,您可以执行以下操作:
META-INF/resources
使用Tomcat 7+。答案 1 :(得分:0)
在我的项目中,我有大约1200个Java类。配置
的包装时间更长<attachClasses>true</attachClasses>
<archiveClasses>true</archiveClasses>
我的直觉告诉我应该没有区别。但是包装阶段的时间更好(37对17秒)