I've recently bought an Intel 520 SSD, so my top priority for my laptop is to reduce the disk write during daily use. In the Java world, Maven is one of the most common build tool out there. My most used Maven command is:
mvn clean package
This command will do a fresh build of the project, then copy all the compiled classes/resources to the build directory of Maven (which is the folder 'target', next to your source directory). If you have a large Maven project at hand, this command will perform thousands disk write (clean compiled classes and resources, then compile Java classes and assemble the resources into WAR/JAR file). By changing the build directory of Maven to /tmp (which is a tmpfs mountpoint (residing on RAM on my ArchLinux)), I can now rebuild my project as many times as I like without the write amplication concern. Here is now I do it in Maven:
- Define a property name target.directory with the default value is target
- Under the build section in your POM file, add this tag <directory>${target.directory}</directory>
- Modify your settings.xml file to include this snippet in your active profile:
/tmp/maven/${project.groupId}-${project.artifactId}/target
And the sample settings.xml file:4.0.0 com.abc abc war 1.0 Sampe Webapp http://www.abc.com target junit junit 3.8.1 test abc ${target.directory} maven-eclipse-plugin 2.8 true true target target 2 ${project.build.outputDirectory}
Happy coding!development /tmp/maven/${project.groupId}-${project.artifactId}/target public-snapshots development
1 comments:
Thanks a lot, that was useful=)
Post a Comment