https://github.com/mikolak-net/java8-quickstart-archetype
Very basic Java 8 archetype.
https://github.com/mikolak-net/java8-quickstart-archetype
java-8 maven-archetype
Last synced: about 1 year ago
JSON representation
Very basic Java 8 archetype.
- Host: GitHub
- URL: https://github.com/mikolak-net/java8-quickstart-archetype
- Owner: mikolak-net
- License: bsd-3-clause
- Created: 2014-07-14T19:35:31.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-03-22T20:43:48.000Z (over 8 years ago)
- Last Synced: 2025-03-24T18:21:28.863Z (over 1 year ago)
- Topics: java-8, maven-archetype
- Homepage:
- Size: 32.2 KB
- Stars: 21
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.asciidoc
- License: LICENSE
Awesome Lists containing this project
README
# java8-quickstart-archetype
:experimental:
:groupId: pl.org.miki
:artifactId: java8-quickstart-archetype
:version: 1.0.0
:noteOption: (see <<_options,Options>> for more info)
:artifactSearchName: java8
//due to lack of includes (see https://github.com/github/markup/issues/335), have to make-do with the following
:optionLinesBatch1: -DcompilerMode=[simple, test-only, retrolambda-main, retrolambda-all] \ #optional
:optionLinesBatch2: -DtestLibrary=[junit, testng, none] #optional
:optionLinesBatch3:
:optionLineInteractive: compilerMode, testLibrary
:toc: right
image:https://travis-ci.org/mikolak-net/java8-quickstart-archetype.svg?branch=master["Build Status", link="https://travis-ci.org/mikolak-net/java8-quickstart-archetype"]
## Introduction
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` and `test`.
* lets you setup many Java 8 configuration variants for all your legacy needs {noteOption}.
* 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.
## Options
* `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 https://github.com/orfjackal/retrolambda[retrolambda].
** `retrolambda-all`: all code is compiled as Java 8, and then converted to Java 7 via https://github.com/orfjackal/retrolambda[retrolambda].
* `testLibrary`: [`junit`, `testng`, `none`]. DEFAULT: `junit`. Adds the requested test library to the POM deps.
NOTE: https://github.com/orfjackal/retrolambda#maven-plugin[Retrolambda] support provided "as is" - if you have any problems, please file a ticket on the GitHub page!
## Usage
Analogous to `maven-quickstart-archetype`. Since the archetype is now on Maven Central, you don't need to download anything.
### CLI
#### Batch
[source,bash,subs="attributes"]
----
mvn archetype:generate -B \
-DarchetypeGroupId={groupId} -DarchetypeArtifactId={artifactId} -DarchetypeVersion={version} \
-DgroupId=com.example -DartifactId=project -Dversion=1.0 -Dpackage=com.example.project \
{optionLinesBatch1}
{optionLinesBatch2}
{optionLinesBatch3}
----
#### Interactive
[source,bash,subs="attributes"]
----
cd x #where x is your "workspace" directory
mvn archetype:generate
#filter by e.g. "{artifactSearchName}", or gId:aId, which is {groupId}:{artifactId}
#input artifactId etc.
----
### IDE
#### Eclipse
. menu:New ...[Project... > Maven > Maven Project > Next].
. Filter for +{artifactId}+. btn:[Next].
. Fill out the necessary values {noteOption}. btn:[Finish]
#### IntelliJ IDEA
[subs="attributes"]
. menu:Create New Project[Maven].
. Check `Create from archetype`.
. *_On first generation only:_* btn:[Add Archetype...]
.. `GroupID` = +{groupId}+
.. `ArtifactId` = +{artifactId}+
.. `Version` = +{version}+
. Select the +{artifactId}+ archetype from the list. btn:[Next].
. Enter the Maven coordinates of _your_ project. btn:[Next].
. Add +{optionLineInteractive}+ to the options {noteOption}.
. Fill out remaining details and btn:[Finish].
## Why yet another archetype?
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,
https://en.wikipedia.org/wiki/Maven[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
https://en.wikipedia.org/wiki/Single_responsibility_principle[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.
Nowadays, various 3rd party ecosystem libs (such as the aforementioned http://junit.org/[three]
http://www.scalatest.org/[testing] https://etorreborre.github.io/specs2/[libraries] )
tend to do a decent job at introducing new developers. Therefore, it is posited that it's more efficient for
an archetype to just focus on providing a _tabula rasa_.