Reputation: 1136
why does maven ear plugin runs the war:war (plugin goal) when I try to build the ear project from netbeans
my process:
I right click on the ear project (which has the war dependency listed) and first Clean and then right click on it and select Build with Dependencies. Then it builds the war again using the war:war and it takes time. even though there was no change in the war but will re create it again.
this is what it says :
------------------------------------------------------------------------ Building finweb 1.0-SNAPSHOT ------------------------------------------------------------------------ The POM for org.netbeans.external:jdom-1.0:jar:RELEASE71 is missing, no dependency information available The POM for com.ibm:com.ibm.mq:jar:6.0.2.5 is missing, no dependency information available The POM for com.ibm:com.ibm.mqbind:jar:6.0.2.5 is missing, no dependency information available The POM for net.sf.saxon:saxon:jar:10.0-b19 is missing, no dependency information available
[dependency:copy]
[resources:resources] Using 'UTF-8' encoding to copy filtered resources. skip non existing resourceDirectory C:\Beta\fin\finweb\src\main\resources
[compiler:compile] Nothing to compile - all classes are up to date
[resources:testResources] Using 'UTF-8' encoding to copy filtered resources. skip non existing resourceDirectory C:\Beta\fin\finweb\src\test\resources
[compiler:testCompile] Nothing to compile - all classes are up to date
[surefire:test] No tests to run. Surefire report directory: C:\Beta\fin\finweb\target\surefire-reports
------------------------------------------------------- T E S T S ------------------------------------------------------- There are no tests to run.
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[war:war] Packaging webapp Assembling webapp [finweb] in [C:\Beta\fin\finweb\target\finweb-1.0-SNAPSHOT] Processing war project Copying webapp resources [C:\Beta\fin\finweb\src\main\webapp] Webapp assembled in [109467 msecs] Building war: C:\Beta\fin\finweb\target\finweb-1.0-SNAPSHOT.war WEB-INF\web.xml already added, skipping
[install:install] Installing C:\Beta\fin\finweb\target\finweb-1.0-SNAPSHOT.war to C:\Documents and Settings.m2\repository\com\comp\finweb\1.0-SNAPSHOT\finweb-1.0-SNAPSHOT.war Installing C:\Beta\fin\finweb\pom.xml to C:\Documents and Settings\5510041.m2\repository\com\comp\finweb\1.0-SNAPSHOT\finweb-1.0-SNAPSHOT.pom
So if there is nothing to compile why would it build a war again if it was already made and there are no changes. is this the default behaviour, looking at compile : compile when it doesnt compile if there is nothing needed then why does war:war does it, it shud be intelligent enuff to do it right?
pls correct me if I am wrong
Thanks in advance..
Syed.
Upvotes: 3
Views: 1377
Reputation: 974
This may be considered as workaround.
Following configs will speed up your build time.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<useCache>true</useCache>
<recompressZippedFiles>false</recompressZippedFiles>
</configuration>
</plugin>
Reference :https://maven.apache.org/plugins/maven-war-plugin/war-mojo.html
Also am looking forward for easy way to skip war:war phase from maven default build lifecycle.
Upvotes: 3
Reputation: 10639
Your concern can be understood. But in principle maven-war-plugin does not know that the resulting WAR artifact will be identical to one which was build a minute ago because:
MANIFEST
entry that contains the current build time.So it is safer to rebuild war each time. On modern platforms this is really negligible.
Upvotes: 1