java-bones

A maven-archetype for a basic Java scaffold that is hosted on github

License

License

Categories

Categories

Java Languages Net
GroupId

GroupId

net.digital-alexandria
ArtifactId

ArtifactId

java-bones
Last Version

Last Version

0.2
Release Date

Release Date

Type

Type

jar
Description

Description

java-bones
A maven-archetype for a basic Java scaffold that is hosted on github

Download java-bones

How to add to project

<!-- https://jarcasting.com/artifacts/net.digital-alexandria/java-bones/ -->
<dependency>
    <groupId>net.digital-alexandria</groupId>
    <artifactId>java-bones</artifactId>
    <version>0.2</version>
</dependency>
// https://jarcasting.com/artifacts/net.digital-alexandria/java-bones/
implementation 'net.digital-alexandria:java-bones:0.2'
// https://jarcasting.com/artifacts/net.digital-alexandria/java-bones/
implementation ("net.digital-alexandria:java-bones:0.2")
'net.digital-alexandria:java-bones:jar:0.2'
<dependency org="net.digital-alexandria" name="java-bones" rev="0.2">
  <artifact name="java-bones" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.digital-alexandria', module='java-bones', version='0.2')
)
libraryDependencies += "net.digital-alexandria" % "java-bones" % "0.2"
[net.digital-alexandria/java-bones "0.2"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

maven-archetype

Project Status Build Status Codacy Badge Maven Central

A maven-archetype for github-hosted Java projects.

Introduction

maven-archetype lets you build a simple maven project that is hosted on github. It not only contains the standard src and pom.xml structure, but furthermore includes a couple of more files that I routinely use for Java projects like:

  • a GPL3 license,
  • static code analysis and reports using findbugs, pmd and checkstyle ,
  • a unit-test suite using JUnit and logging using log4j/slf4j,
  • badges for the project status, build status using Travis CI and code coverage using Jacoco,
  • custom README.md, TODO.md and VERSIONS.md files and
  • a prototype Main.java + TestSuite.java.

The resulting folder-structure looks like this:

  |____emptyproject4j
  | |____.codecov.yml
  | |____.gitignore
  | |____.travis.yml
  | |____build.sh
  | |____config
  | | |____checkstyle
  | | | |____checkstyle.xml
  | | |____pmd
  | | | |____ruleset.xml
  | |____emptyproject4j
  | |____LICENSE
  | |____pom.xml
  | |____README.md
  | |____src
  | | |____main
  | | | |____java
  | | | | |____net
  | | | | | |____groupID
  | | | | | | |____emptyproject4j
  | | | | | | | |____Main.java
  | | |____test
  | | | |____java
  | | | | |____net
  | | | | | |____groupID
  | | | | | | |____tests
  | | | | | | | |____emptyproject4j
  | | | | | | | | |____TestSuite.java
  | |____TODO.md
  | |____VERSIONS.md

Installation

Download the most recent release and unpack it. Afterwards install the project using:

  mvn clean install

Using mvn of course requires you to have maven.

Usage

Building a scaffold

If you want to build the scaffold call this on the command line:

  mvn archetype:generate \
   -DarchetypeGroupId=net.digital-alexandria \
   -DarchetypeArtifactId=java-bones \
   -DarchetypeVersion=0.2 \
   -DgroupId=<net.groupID> \
   -DartifactId=<emptyproject4j> \
   -Duser='<my name>' \
   -Dgithubuser=<githubuser> \
   -Demail='<[email protected]>' \
   -Ddescription='<this project is just awesome>'

Just don't forget to customize the data within the <, > (also remove the brackets).

Building the project

Packaging and running is done using

  ./build.sh
  ./emptyproject4j

I think you need to chmod +x build.sh/emptyproject4j before.

Alternatively you can of course use the standard

  mvn clean project

This creates target/emptyproject4j-standalone.jar which you can call using

  java -jar target/emptyproject4j-standalone.jar

Checking and code analysis

Check and validate your code using

  mvn verify
  mvn test

This calls pmd, checkstyle, findbugs and surefire.

You can also call the goals separately with

  mvn checkstyle:check
  mvn pmd:check
  mvn findbugs:check
  mvn test

Code coverage

Code coverage is generated using

  mvn jacoco:report

Author

Versions

Version
0.2
0.1