Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Very basic Java 8 archetype.

License

NotificationsYou must be signed in to change notification settings

mikolak-net/java8-quickstart-archetype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

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 createsempty package directories formain andtest.

  • lets you setup many Java 8 configuration variants for all your legacy needs (seeOptions 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.

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 viaretrolambda.

    • retrolambda-all: all code is compiled as Java 8, and then converted to Java 7 viaretrolambda.

  • 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!

Usage

Analogous tomaven-quickstart-archetype. Since the archetype is now on Maven Central, you don’t need to download anything.

CLI

Batch

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

Interactive

cd x#where x is your "workspace" directorymvn archetype:generate#filter by e.g. "java8", or gId:aId, which is pl.org.miki:java8-quickstart-archetype#input artifactId etc.

IDE

Eclipse

  1. New …​ Project…​ Maven Maven Project Next.

  2. Filter for {artifactId}.Next.

  3. Fill out the necessary values (seeOptions for more info).Finish

IntelliJ IDEA

  1. Create New Project Maven.

  2. CheckCreate from archetype.

  3. On first generation only:Add Archetype…​

    1. GroupID = {groupId}

    2. ArtifactId = {artifactId}

    3. Version = {version}

  4. Select the {artifactId} archetype from the list.Next.

  5. Enter the Maven coordinates ofyour project.Next.

  6. Add {optionLineInteractive} to the options (seeOptions for more info).

  7. Fill out remaining details andFinish.

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,mavens.

Given that, let’s take a look at some "generic" archetypes such asnet.alchim31.maven:scala-archetype-simpleororg.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 thanthree 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 theSRP.

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 popularexclusive configurationvariants, and with theleast "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 aforementionedthreetestinglibraries )tend to do a decent job at introducing new developers. Therefore, it is posited that it’s more efficient foran archetype to just focus on providing atabula rasa.

About

Very basic Java 8 archetype.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp