Maven specify compiler version

if you want to enable assertions/annotations/generics/for-each (-source 1.6) and also want the compiled classes to be compatible with JVM 1.6 (-target 1.6)

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>

if you want to generate a jar with dependencies

<plugin>
 <artifactId>maven-assembly-plugin</artifactId>
 <configuration>
 <descriptorRefs>
 <descriptorRef>jar-with-dependencies</descriptorRef>
 </descriptorRefs>
 </configuration>
 </plugin>

mvn assembly:assembly

This entry was posted in maven and tagged , . Bookmark the permalink.

Leave a comment