A bloody simple Java 8 archetype. Has the following features:
-
minimizes the amount of "example" files that you would have to delete anyway (cf.
maven-quickstart-archetype
). -
automatically creates empty package directories for
main
andtest
. -
lets you setup many Java 8 configuration variants for all your legacy needs (see Options for more info).
-
optionally includes JUnit or TestNG dependencies (JUnit by default).
In general, this archetype is primarily useful for quickly creating cruft-free projects for Java 8 development.
-
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.
-
-
testLibrary
: [junit
,testng
,none
]. DEFAULT:junit
. Adds the requested test library to the POM deps.
Note
|
Retrolambda support provided "as is" - if you have any problems, please file a ticket on the GitHub page! |
Analogous to maven-quickstart-archetype
. Since the archetype is now on Maven Central, you don’t need to download anything.
mvn archetype:generate -B \
-DarchetypeGroupId=pl.org.miki -DarchetypeArtifactId=java8-quickstart-archetype -DarchetypeVersion=1.0.0 \
-DgroupId=com.example -DartifactId=project -Dversion=1.0 -Dpackage=com.example.project \
-DcompilerMode=[simple, test-only, retrolambda-main, retrolambda-all] \ #optional
-DtestLibrary=[junit, testng, none] #optional
-
New … › Project… › Maven › Maven Project › Next.
-
Filter for {artifactId}. Next.
-
Fill out the necessary values (see Options for more info). Finish
-
Create New Project › Maven.
-
Check
Create from archetype
. -
On first generation only: Add Archetype…
-
GroupID
= {groupId} -
ArtifactId
= {artifactId} -
Version
= {version}
-
-
Select the {artifactId} archetype from the list. Next.
-
Enter the Maven coordinates of your project. Next.
-
Add {optionLineInteractive} to the options (see Options for more info).
-
Fill out remaining details and Finish.
An excellent question! First of all, archetypes are sometimes quite underrated as a concept - they provide a gateway to various technologies and frameworks to coders who are not Maven, er, mavens.
Given that, let’s take a look at some "generic" archetypes such as net.alchim31.maven:scala-archetype-simple
or org.apache.maven.archetypes:maven-archetype-quickstart
. After project creation,
it becomes apparent that they serve mainly the following purposes:
-
creating the POM boilerplate for the specific project type,
-
introducing the POM creator to some associated frameworks, technologies and/or patterns (e.g. the Scala archetype includes no less than three different test libraries at the same time).
At this point, coupled with the premise that POMs are essentially executable (declarative) build configuration code, it can be argued that the aforementioned archetypes fail the SRP.
The archetype you’re now viewing, and its sister project, attempt to alleviate this problem.
Namely, they have a single goal in mind: enable a user to create multiple projects, with the most popular exclusive configuration variants, and with the least "educto-boilerplate" to clean up.
The last subpoint emphasizes why this goal was chosen as a primary one, over educating newcomers.