archetype-resources.pom.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java8-quickstart-archetype Show documentation
Show all versions of java8-quickstart-archetype Show documentation
Basic Java 8 archetype. Options:
-testLibrary: [junit, testng, none]. DEFAULT: junit. Adds the requested test library to the POM deps.
-compilerMode: [simple, test-only, retrolambda-main, retrolambda-all]. DEFAULT: simple.
--simple: everything is compiled as Java 8.
--test-only: set up test for Java 8, and main for Java 7.
--retrolambda-main: main code is compiled as Java 8, and then converted to Java 7 via retrolambda.
--retrolambda-all: all code is compiled as Java 8, and then converted to Java 7 via retrolambda.
NOTE: Retrolambda support provided "as is" - if you have any problems, please file a ticket on the GitHub page!
The newest version!
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>${groupId}</groupId> <artifactId>${artifactId}</artifactId> <version>${version}</version> <packaging>jar</packaging> ##macro for error messages #macro( checkPropertyValid $paramName $paramValue $legalValues ) #if (!$legalValues.contains($paramValue)) ------- <ERROR>: "$paramName"=$paramValue, which is an invalid value! Allowed values are: $legalValues. See the archetype description and rerun archetype:generate ------- #end #end ## #set ($javaVersionSuperior = "1.8") #set ($javaVersionInferior = "1.7") ## because it is! ## #set ($retroLambdaAll = "retrolambda-all") #set ($retroLambdaOpts = ["retrolambda-main",$retroLambdaAll]) ## #set ($testOnlyMode = "test-only") #set ($validCompilerModes = ["simple",$testOnlyMode]) #set ($dummyResult = $validCompilerModes.addAll($retroLambdaOpts)) ## #set ($isModeRetroLambda = $retroLambdaOpts.contains($compilerMode)) #set ($isModeTestOnly = $compilerMode == $testOnlyMode) <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> #checkPropertyValid( "compilerMode" $compilerMode $validCompilerModes ) #if ($isModeTestOnly) <java.version>${javaVersionInferior}</java.version> <java.version.test>${javaVersionSuperior}</java.version.test> <compiler.path><!-- your ${javaVersionInferior} javac path here, e.g. /usr/lib/jvm/java-7-oracle --></compiler.path> <compiler.path.test><!-- your ${javaVersionSuperior} javac path here, e.g. /usr/lib/jvm/java-8-oracle --></compiler.path.test> #else <java.version>${javaVersionSuperior}</java.version> #end #if ($isModeRetroLambda) <retrolambda.target>${javaVersionInferior}</retrolambda.target> #end </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> #if ($isModeTestOnly) <executable>${compiler.path}/bin/javac</executable> <compilerVersion>${java.version}</compilerVersion> #end </configuration> #if ($isModeTestOnly) <executions> <execution> <id>default-testCompile</id> <phase>test-compile</phase> <goals> <goal>testCompile</goal> </goals> <configuration> <fork>true</fork> <executable>${compiler.path.test}/bin/javac</executable> <source>${java.version.test}</source> <target>${java.version.test}</target> </configuration> </execution> </executions> #end </plugin> #if ($isModeRetroLambda) <plugin> <groupId>net.orfjackal.retrolambda</groupId> <artifactId>retrolambda-maven-plugin</artifactId> <version>1.4.0</version> <executions> <execution> <goals> <goal>process-main</goal> #if ($compilerMode == $retroLambdaAll) <goal>process-test</goal> #end </goals> <configuration> <target>${retrolambda.target}</target> </configuration> </execution> </executions> </plugin> #end </plugins> </build> <dependencies> ##test library code #set ($supportedLibs = ["junit","testng"]) #set ($validTestLibraries = ["none"]) #set ($dummyResult = $validTestLibraries.addAll($supportedLibs)) ## #checkPropertyValid( "testLibrary" $testLibrary $validTestLibraries ) ## #if ( $supportedLibs.contains($testLibrary)) <dependency> #if ( $testLibrary == "junit" ) <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> #elseif ( $testLibrary == "testng" ) <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>6.8.8</version> #end <scope>test</scope> </dependency> #elseif ( $testLibrary == "none") <!-- include your dependencies here --> #end </dependencies> </project>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy