Improve Maven build time dramatically by moving source and javadoc to profiles.

This makes a *huge* difference in build time (mvn clean install
-DskipTests takes about 1/3 as long with this in place). It moves
source and javadoc into profiles, so that if you want to build the
source jars and javadoc jars, you specify -Psrc and -Pdoc respectively.
This commit is contained in:
Andrew Bayer 2012-06-21 11:37:06 -07:00
parent a12e10d7f3
commit 9112a832fc
2 changed files with 88 additions and 78 deletions

51
pom.xml
View File

@ -54,38 +54,6 @@
</modules> </modules>
<build> <build>
<plugins> <plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>javadoc</id>
<phase>package</phase>
<goals>
<goal>aggregate-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<additionalJOption>-J-Xmx512m</additionalJOption>
<encoding>${project.build.sourceEncoding}</encoding>
<quiet>true</quiet>
<links>
<link>http://download.oracle.com/javase/6/docs/api/</link>
</links>
<footer><![CDATA[
<!-- Google Analytics -->
<script type='text/javascript'>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type='text/javascript'>
try {
var pageTracker = _gat._getTracker("UA-8638379-1");
pageTracker._trackPageview();
} catch(err) {}</script>
]]></footer>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>com.mycila.maven-license-plugin</groupId> <groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId> <artifactId>maven-license-plugin</artifactId>
@ -144,5 +112,24 @@ pageTracker._trackPageview();
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile>
<id>doc</id>
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>javadoc</id>
<phase>package</phase>
<goals>
<goal>aggregate-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles> </profiles>
</project> </project>

View File

@ -429,52 +429,6 @@
</systemPropertyVariables> </systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
<!-- make sure we generate src jars too -->
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<id>javadoc</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<configuration>
<additionalJOption>-J-Xmx256m</additionalJOption>
<encoding>${project.build.sourceEncoding}</encoding>
<quiet>true</quiet>
<links>
<link>http://download.oracle.com/javase/6/docs/api/</link>
</links>
<footer><![CDATA[
<!-- Google Analytics -->
<script type='text/javascript'>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type='text/javascript'>
try {
var pageTracker = _gat._getTracker("UA-8638379-1");
pageTracker._trackPageview();
} catch(err) {}</script>
]]></footer>
</configuration>
</plugin>
<plugin> <plugin>
<artifactId>maven-enforcer-plugin</artifactId> <artifactId>maven-enforcer-plugin</artifactId>
<version>1.1</version> <version>1.1</version>
@ -612,6 +566,9 @@ pageTracker._trackPageview();
<plugin> <plugin>
<artifactId>maven-release-plugin</artifactId> <artifactId>maven-release-plugin</artifactId>
<version>2.3.1</version> <version>2.3.1</version>
<configuration>
<releaseProfiles>doc</releaseProfiles>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<artifactId>maven-pmd-plugin</artifactId> <artifactId>maven-pmd-plugin</artifactId>
@ -746,6 +703,32 @@ pageTracker._trackPageview();
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<additionalJOption>-J-Xmx256m</additionalJOption>
<encoding>${project.build.sourceEncoding}</encoding>
<quiet>true</quiet>
<links>
<link>http://download.oracle.com/javase/6/docs/api/</link>
</links>
<footer><![CDATA[
<!-- Google Analytics -->
<script type='text/javascript'>
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type='text/javascript'>
try {
var pageTracker = _gat._getTracker("UA-8638379-1");
pageTracker._trackPageview();
} catch(err) {}</script>
]]>
</footer>
</configuration>
</plugin>
</plugins> </plugins>
</pluginManagement> </pluginManagement>
</build> </build>
@ -914,5 +897,45 @@ pageTracker._trackPageview();
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile>
<id>doc</id>
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8.1</version>
<executions>
<execution>
<id>javadoc</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>src</id>
<build>
<plugins>
<!-- make sure we generate src jars too -->
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles> </profiles>
</project> </project>