├── .travis ├── .gitignore ├── release.sh └── settings.xml ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ ├── maven-wrapper.properties │ └── MavenWrapperDownloader.java ├── .travis.yml ├── tests ├── java-sample │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── efenglu │ │ │ │ └── javaSample │ │ │ │ └── TestPojo.java │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── efenglu │ │ │ └── javaSample │ │ │ └── TestPojoSpec.groovy │ └── pom.xml └── pom.xml ├── tiles ├── project-java-release │ ├── tile.xml │ └── pom.xml ├── groovy-test │ ├── tile.xml │ └── pom.xml ├── nexus │ ├── tile.xml │ └── pom.xml ├── source-jar │ ├── tile.xml │ └── pom.xml ├── java │ ├── pom.xml │ └── tile.xml ├── gpg │ ├── tile.xml │ └── pom.xml ├── fatJar │ ├── pom.xml │ └── tile.xml ├── git-info │ ├── pom.xml │ └── tile.xml ├── jacoco │ ├── pom.xml │ └── tile.xml ├── flatten │ ├── pom.xml │ └── tile.xml ├── javadoc │ ├── pom.xml │ └── tile.xml ├── manifest │ ├── pom.xml │ └── tile.xml ├── protobuf │ ├── pom.xml │ └── tile.xml ├── surefire │ ├── pom.xml │ └── tile.xml ├── enforcer │ ├── pom.xml │ └── tile.xml ├── project-java │ ├── pom.xml │ └── tile.xml ├── dependency-check │ ├── pom.xml │ └── tile.xml ├── integration-test │ ├── pom.xml │ └── tile.xml ├── checkstyle │ ├── pom.xml │ └── tile.xml └── pom.xml ├── .gitignore ├── README.md ├── checkstyle-config ├── pom.xml └── src │ └── main │ └── resources │ └── checkstyle.xml ├── LICENSE ├── RELEASE.md ├── pom.xml ├── mvnw.cmd ├── mvnw └── medium.md /.travis/.gitignore: -------------------------------------------------------------------------------- 1 | credentials.sh -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efenglu/maven/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk8 4 | #deploy: 5 | # provider: script 6 | # script: ".travis/release.sh" 7 | # on: 8 | # tags: true -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar 3 | -------------------------------------------------------------------------------- /tests/java-sample/src/main/java/com/efenglu/javaSample/TestPojo.java: -------------------------------------------------------------------------------- 1 | package com.efenglu.javaSample; 2 | 3 | import lombok.Builder; 4 | import lombok.Value; 5 | 6 | @Value 7 | @Builder 8 | public class TestPojo { 9 | String s1; 10 | int v2; 11 | } 12 | -------------------------------------------------------------------------------- /tiles/project-java-release/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | io.github.efenglu.maven.tiles:gpg:[@project.version@,2.0.0) 5 | io.github.efenglu.maven.tiles:nexus:[@project.version@,2.0.0) 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | pom.xml.tag 3 | pom.xml.releaseBackup 4 | pom.xml.versionsBackup 5 | pom.xml.next 6 | release.properties 7 | dependency-reduced-pom.xml 8 | buildNumber.properties 9 | .mvn/timing.properties 10 | 11 | # Avoid ignoring Maven wrapper jar file (.jar files are usually ignored) 12 | !/.mvn/wrapper/maven-wrapper.jar 13 | 14 | .flattened-pom.xml 15 | -------------------------------------------------------------------------------- /tests/java-sample/src/test/java/com/efenglu/javaSample/TestPojoSpec.groovy: -------------------------------------------------------------------------------- 1 | package com.efenglu.javaSample 2 | 3 | import spock.lang.Specification 4 | 5 | 6 | class TestPojoSpec extends Specification { 7 | 8 | def "test pojo"() { 9 | given: 10 | TestPojo testPojo = TestPojo.builder().s1("hello").build() 11 | 12 | when: 13 | testPojo.s1 = "hello2" 14 | 15 | then: 16 | thrown(ReadOnlyPropertyException) 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /tiles/groovy-test/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.codehaus.gmavenplus 8 | gmavenplus-plugin 9 | 1.6.2 10 | 11 | 12 | 13 | compileTests 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Maven Pom Configuration 2 | 3 | [![Build Status](https://travis-ci.com/efenglu/maven.svg?branch=master)](https://travis-ci.com/efenglu/maven) 4 | 5 | Best practices for a full featured maven pom including: 6 | * Maven Tiles 7 | * Checkstyle Config 8 | * Examples as tests 9 | 10 | ## Usage 11 | 12 | Configuring a project: 13 | ```xml 14 | 15 | io.repaint.maven 16 | tiles-maven-plugin 17 | 2.12 18 | true 19 | 20 | 21 | io.github.efenglu.maven.tiles:project-java:[1.0, 2) 22 | 23 | 24 | 25 | ``` -------------------------------------------------------------------------------- /tiles/nexus/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | org.sonatype.plugins 10 | nexus-staging-maven-plugin 11 | 1.6.8 12 | true 13 | 14 | ossrh 15 | https://oss.sonatype.org/ 16 | false 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tiles/source-jar/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.apache.maven.plugins 8 | maven-source-plugin 9 | 3.0.1 10 | 11 | 12 | attach-sources 13 | package 14 | 15 | jar-no-fork 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /.travis/release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -e 2 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" 3 | 4 | export VERSION=$1 5 | 6 | if [[ -z "$VERSION" ]]; then 7 | echo "ERROR: Version is undefined" 8 | exit 1 9 | fi 10 | if [[ -z "${SONATYPE_USERNAME}" ]]; then 11 | echo "ERROR: SONATYPE_USERNAME is undefined" 12 | exit 1 13 | fi 14 | if [[ -z "${SONATYPE_PASSWORD}" ]]; then 15 | echo "ERROR: SONATYPE_PASSWORD is undefined" 16 | exit 1 17 | fi 18 | if [[ -z "${GPG_KEYNAME}" ]]; then 19 | echo "ERROR: GPG_KEYNAME is undefined" 20 | exit 1 21 | fi 22 | if [[ -z "${GPG_PASSPHRASE}" ]]; then 23 | echo "ERROR: GPG_PASSPHRASE is undefined" 24 | exit 1 25 | fi 26 | 27 | mvn versions:set -DnewVersion=${VERSION} -DgenerateBackupPoms=false 28 | mvn clean deploy -B -P release --settings ${DIR}/settings.xml 29 | git checkout . 30 | git tag $VERSION 31 | git push --tags -------------------------------------------------------------------------------- /tiles/java/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | 4 | 5 | io.github.efenglu.maven.tiles 6 | tiles-parent 7 | 1.0.X-SNAPSHOT 8 | 9 | 10 | java 11 | Tile: ${project.artifactId} 12 | 13 | tile 14 | 15 | Setup Standard Java build 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /checkstyle-config/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | io.github.efenglu 7 | maven-parent 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | checkstyle-config 13 | 14 | 15 | 8.18 16 | 17 | 18 | 19 | 20 | com.puppycrawl.tools 21 | checkstyle 22 | ${checkstyle.puppycrawl.version} 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tiles/gpg/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | org.apache.maven.plugins 10 | maven-gpg-plugin 11 | 1.6 12 | 13 | 14 | sign-artifacts 15 | verify 16 | 17 | sign 18 | 19 | 20 | 21 | --batch 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/fatJar/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | fatJar 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/git-info/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | git-info 13 | Tile: ${project.artifactId} 14 | tile 15 | 16 | 17 | 18 | 19 | io.repaint.maven 20 | tiles-maven-plugin 21 | true 22 | 23 | false 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tiles/gpg/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | gpg 13 | 14 | Tile: ${project.artifactId} 15 | 16 | tile 17 | 18 | 19 | 20 | 21 | io.repaint.maven 22 | tiles-maven-plugin 23 | true 24 | 25 | false 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tiles/jacoco/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | jacoco 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/flatten/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | flatten 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/javadoc/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | io.github.efenglu.maven.tiles 7 | tiles-parent 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | javadoc 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/manifest/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | manifest 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/nexus/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | nexus 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tiles/protobuf/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | protobuf 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/surefire/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | surefire 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/enforcer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | enforcer 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tiles/groovy-test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | io.github.efenglu.maven.tiles 7 | tiles-parent 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | groovy-test 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/project-java/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | project-java 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | true 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/source-jar/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | source-jar 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tiles/dependency-check/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | dependency-check 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /tiles/integration-test/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | integration-test 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | false 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Erik Englund 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tiles/project-java-release/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | project-java-release 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | 20 | io.repaint.maven 21 | tiles-maven-plugin 22 | true 23 | 24 | true 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /.travis/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | ossrh 9 | ${env.SONATYPE_USERNAME} 10 | ${env.SONATYPE_PASSWORD} 11 | 12 | 13 | 14 | 15 | 16 | ossrh 17 | 18 | gpg 19 | ${env.GPG_PASSPHRASE} 20 | ${env.GPG_KEYNAME} 21 | ${gpg.keyname} 22 | false 23 | 24 | 25 | 26 | 27 | 28 | ossrh 29 | 30 | 31 | -------------------------------------------------------------------------------- /tiles/java/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1.8 6 | false 7 | false 8 | true 9 | true 10 | 3.7.0 11 | 12 | 13 | 14 | 15 | 16 | org.apache.maven.plugins 17 | maven-compiler-plugin 18 | ${maven-compiler-plugin.version} 19 | true 20 | 21 | ${java.optimize} 22 | ${java.debug} 23 | ${java.version} 24 | ${java.version} 25 | ${showDeprecation} 26 | ${showWarnings} 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tiles/project-java/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | io.github.efenglu.maven.tiles:checkstyle:[@project.version@,2.0.0) 5 | io.github.efenglu.maven.tiles:dependency-check:[@project.version@,2.0.0) 6 | io.github.efenglu.maven.tiles:enforcer:[@project.version@,2.0.0) 7 | io.github.efenglu.maven.tiles:flatten:[@project.version@,2.0.0) 8 | io.github.efenglu.maven.tiles:git-info:[@project.version@,2.0.0) 9 | io.github.efenglu.maven.tiles:groovy-test:[@project.version@,2.0.0) 10 | io.github.efenglu.maven.tiles:integration-test:[@project.version@,2.0.0) 11 | io.github.efenglu.maven.tiles:jacoco:[@project.version@,2.0.0) 12 | io.github.efenglu.maven.tiles:java:[@project.version@,2.0.0) 13 | io.github.efenglu.maven.tiles:javadoc:[@project.version@,2.0.0) 14 | io.github.efenglu.maven.tiles:manifest:[@project.version@,2.0.0) 15 | io.github.efenglu.maven.tiles:source-jar:[@project.version@,2.0.0) 16 | io.github.efenglu.maven.tiles:surefire:[@project.version@,2.0.0) 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /tiles/surefire/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 2.20 6 | 7 | 8 | 9 | 10 | 11 | org.apache.maven.plugins 12 | maven-surefire-plugin 13 | ${maven-surefire-plugin.version} 14 | 15 | 16 | **/*Spec.* 17 | **/*Specs.* 18 | **/*Test.* 19 | **/*Tests.* 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | org.apache.maven.plugins 30 | maven-surefire-report-plugin 31 | ${maven-surefire-plugin.version} 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /tiles/git-info/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | false 6 | 7 | 8 | 9 | 10 | 11 | pl.project13.maven 12 | git-commit-id-plugin 13 | 2.2.6 14 | 15 | true 16 | true 17 | true 18 | ${project.build.outputDirectory}/git.properties 19 | ${failOnNoGitDirectory} 20 | 21 | 22 | 23 | get-the-git-infos 24 | 25 | revision 26 | 27 | validate 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /tiles/checkstyle/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | tiles-parent 7 | io.github.efenglu.maven.tiles 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | checkstyle 13 | Tile: ${project.artifactId} 14 | 15 | tile 16 | 17 | 18 | 19 | io.github.efenglu 20 | checkstyle-config 21 | 1.0.X-SNAPSHOT 22 | 23 | 24 | 25 | 26 | 27 | 28 | io.repaint.maven 29 | tiles-maven-plugin 30 | true 31 | 32 | true 33 | pluginmanagement 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tiles/manifest/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | org.apache.maven.plugins 9 | maven-jar-plugin 10 | 3.0.2 11 | 12 | 13 | 14 | true 15 | true 16 | 17 | 18 | ${project.name} 19 | ${project.version} 20 | ${project.groupId}.${project.artifactId} 21 | ${maven.build.timestamp} 22 | ${git.commit.id.abbrev} 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tiles/integration-test/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.apache.maven.plugins 8 | maven-failsafe-plugin 9 | 2.22.1 10 | 11 | ${it.skip} 12 | 13 | **/*IT.* 14 | 15 | 16 | 17 | 18 | integration-test 19 | 20 | integration-test 21 | verify 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | org.apache.maven.plugins 33 | maven-surefire-report-plugin 34 | 35 | 36 | integration-tests 37 | 38 | failsafe-report-only 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /tiles/dependency-check/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | org.apache.maven.plugins 7 | maven-dependency-plugin 8 | 3.1.1 9 | 10 | 11 | analyze 12 | 13 | analyze-only 14 | 15 | 16 | true 17 | true 18 | 19 | org.projectlombok:lombok:: 20 | org.spockframework:spock-core:: 21 | cglib:cglib-nodep:: 22 | org.objenesis:objenesis:: 23 | org.slf4j:slf4j-simple:: 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /tiles/flatten/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | org.codehaus.mojo 12 | flatten-maven-plugin 13 | 1.0.1 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | ${flatten.mode} 25 | true 26 | 27 | 28 | 29 | 30 | flatten 31 | process-resources 32 | 33 | flatten 34 | 35 | 36 | 37 | 38 | flatten.clean 39 | clean 40 | 41 | clean 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /tiles/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | io.github.efenglu 7 | maven-parent 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | io.github.efenglu.maven.tiles 13 | tiles-parent 14 | pom 15 | 16 | Parent Pom for tiles 17 | Parent for all tile flavors 18 | 19 | 20 | java 21 | javadoc 22 | groovy-test 23 | protobuf 24 | surefire 25 | jacoco 26 | integration-test 27 | checkstyle 28 | enforcer 29 | flatten 30 | dependency-check 31 | manifest 32 | git-info 33 | source-jar 34 | fatJar 35 | project-java 36 | gpg 37 | nexus 38 | project-java-release 39 | 40 | 41 | 42 | 43 | 44 | 45 | io.repaint.maven 46 | tiles-maven-plugin 47 | 2.12 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /tests/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | io.github.efenglu.maven.tests 8 | tests 9 | 1.0.X-SNAPSHOT 10 | pom 11 | 12 | 13 | 14 | MIT License 15 | http://www.opensource.org/licenses/mit-license.php 16 | repo 17 | 18 | 19 | 20 | 21 | 22 | Erik Englund 23 | 24 | 25 | 26 | 27 | scm:git:https://github.com/efenglu/maven.git 28 | scm:git:ssh://github.com/efenglu/maven.git 29 | https://github.com/efenglu/maven 30 | 31 | 32 | 33 | 34 | ossrh 35 | https://oss.sonatype.org/content/repositories/snapshots 36 | 37 | 38 | ossrh 39 | https://oss.sonatype.org/service/local/staging/deploy/maven2/ 40 | 41 | 42 | 43 | 44 | UTF-8 45 | UTF-8 46 | true 47 | 1.0.X-SNAPSHOT 48 | 49 | 50 | 51 | java-sample 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /tiles/javadoc/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 3.0.0-M1 6 | 7 | 8 | 9 | 10 | 11 | org.apache.maven.plugins 12 | maven-javadoc-plugin 13 | ${maven-javadoc-plugin.version} 14 | 15 | false 16 | -Xdoclint:none 17 | 18 | 19 | 20 | org.apache.maven.plugin-tools 21 | maven-plugin-tools-javadoc 22 | 2.9 23 | 24 | 25 | 26 | 27 | 28 | attach-javadocs 29 | 30 | 31 | jar 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | org.apache.maven.plugins 43 | maven-javadoc-plugin 44 | ${maven-javadoc-plugin.version} 45 | 46 | -Xdoclint:none 47 | false 48 | 49 | 50 | 51 | default 52 | 53 | 54 | javadoc 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # Release Process 2 | 3 | ## Setup 4 | Choose a new version for the release. It is best to set this to an environment variable 5 | as we will be referring to it often 6 | 7 | ```bash 8 | export newVersion=1.0.0 9 | ``` 10 | 11 | ## Set the release version 12 | Set the version of the poms to the release artifact version 13 | 14 | ```bash 15 | ./mvnw versions:set -DnewVersion=${newVersion} -DgenerateBackupPoms=false 16 | ``` 17 | 18 | ## Build and Test 19 | Build and test the release to ensure everything is correct 20 | 21 | ```bash 22 | ./mvnw clean install -Prelease 23 | ``` 24 | 25 | Update the tests to point to release and test: 26 | 27 | ```bash 28 | ./mvnw -f tests/pom.xml clean install 29 | ``` 30 | 31 | ## Verify the GPG Signature 32 | Verify the correct signature was used to sign the artifacts 33 | 34 | ```bash 35 | gpg --verify target/maven-parent-${newVersion}.pom.asc 36 | ``` 37 | 38 | ## Deploy the Release to Stagging 39 | Deploy the release as a stagged release to Sonatype 40 | 41 | ```bash 42 | ./mvnw clean deploy -Prelease 43 | ``` 44 | 45 | If everything goes well, we’ll see, among the console outputs, the staging repository id created for the project like this: 46 | 47 | ```bash 48 | * Created staging repository with ID "io.github.efenglu-1001". 49 | ``` 50 | 51 | ## Inspect the stagged artifacts 52 | Inspect the artifacts on Sonatype ensure they are correct 53 | 54 | Let’s log in to [https://oss.sonatype.org](https://oss.sonatype.org) to 55 | inspect the artifacts we’ve deployed to staging. After login, we’ll click on 56 | Staging Repositories on the left side menu under the Build Promotion sub-menu and using the 57 | search bar at the top right of the page, we’ll search for the staging repository ID 58 | created e.g. **io.github.efenglu-1001** in this case. 59 | 60 | We should be able to see and inspect the artifacts that were uploaded by the nexus staging Maven plugin. 61 | 62 | If everything looks right select the stagged repository and click the **close** button. 63 | 64 | ## Commit and Tag Release 65 | Git and tag the release to Github 66 | 67 | ```bash 68 | git add . 69 | git commit -m "Release ${newVersion}" 70 | git tag ${newVersion} 71 | git push --tags 72 | # Roll back all the changes so they don't get added to the main codebase 73 | git reset HEAD~1 74 | git checkout . 75 | git clean -fd 76 | ``` 77 | 78 | ## Deploy the Release 79 | Everything is good to go. Mark the release to be deployed to central. 80 | 81 | ```bash 82 | ./mvnw nexus-staging:release -Prelease -DstagingRepositoryId=iogithubefenglu-1000 83 | ``` -------------------------------------------------------------------------------- /tiles/protobuf/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0.6.1 6 | 1.18.0 7 | 8 | 9 | 10 | 11 | 12 | src/main/proto 13 | 14 | 15 | src/main/resources 16 | 17 | 18 | 19 | 20 | 21 | kr.motd.maven 22 | os-maven-plugin 23 | 1.6.1 24 | true 25 | 26 | 27 | initialize 28 | 29 | detect 30 | 31 | 32 | 33 | 34 | 35 | org.xolstice.maven.plugins 36 | protobuf-maven-plugin 37 | ${protobuf.plugin.version} 38 | 39 | true 40 | com.google.protobuf:protoc:3.6.1:exe:${os.detected.classifier} 41 | 42 | 43 | 44 | protobuf.java 45 | 46 | compile 47 | 48 | generate-sources 49 | 50 | 51 | protobuf.grpc-java 52 | 53 | compile-custom 54 | 55 | generate-sources 56 | 57 | grpc-java 58 | io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /tiles/jacoco/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0.7.6.201602180812 6 | 0.70 7 | 8 | 9 | 10 | 11 | 12 | org.jacoco 13 | jacoco-maven-plugin 14 | ${jacoco.version} 15 | 16 | 17 | jacoco-initialize 18 | initialize 19 | 20 | prepare-agent 21 | 22 | 23 | 24 | jacoco-check 25 | test 26 | 27 | check 28 | 29 | 30 | 31 | 32 | BUNDLE 33 | 34 | **/altova/**/*.* 35 | **/*Spec.* 36 | **/*Specs.* 37 | **/*Test.* 38 | **/*Tests.* 39 | 40 | 41 | 42 | INSTRUCTION 43 | COVEREDRATIO 44 | ${jacoco.bundle.coveredratio.minimum} 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | jacoco-site 53 | verify 54 | 55 | report 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /tiles/checkstyle/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | true 6 | false 7 | @project.version@ 8 | 9 | 10 | 11 | 12 | 13 | 14 | org.apache.maven.plugins 15 | maven-checkstyle-plugin 16 | 3.0.0 17 | 18 | 19 | io.github.efenglu 20 | checkstyle-config 21 | ${checkstyle.config.version} 22 | 23 | 24 | com.puppycrawl.tools 25 | checkstyle 26 | 8.18 27 | 28 | 29 | 30 | checkstyle.xml 31 | ${project.build.sourceEncoding} 32 | 33 | 34 | 35 | 36 | 37 | 38 | org.apache.maven.plugins 39 | maven-checkstyle-plugin 40 | 41 | 42 | verify-checkstyle 43 | verify 44 | 45 | check 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | org.apache.maven.plugins 57 | maven-checkstyle-plugin 58 | ${maven-checkstyle-plugin.version} 59 | 60 | 61 | 62 | checkstyle 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /tiles/fatJar/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | org.apache.maven.plugins 8 | maven-shade-plugin 9 | 10 | 11 | 12 | 13 | META-INF/spring.handlers 14 | 15 | 16 | META-INF/spring.schemas 17 | 18 | 19 | META-INF/spring.tooling 20 | 21 | 22 | 23 | ${project.name} Fat Jar 24 | ${project.version} 25 | ${project.groupId}.${project.artifactId} 26 | 27 | 28 | 29 | 30 | 31 | *:* 32 | 33 | META-INF/*.SF 34 | META-INF/*.DSA 35 | META-INF/*.RSA 36 | 37 | 38 | 39 | 40 | 41 | 42 | jar-with-dependencies 43 | package 44 | 45 | shade 46 | 47 | 48 | jar-with-dependencies 49 | true 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /tiles/enforcer/tile.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 3.5.0 5 | true 6 | 1.8 7 | true 8 | 9 | 10 | 11 | 12 | 13 | org.apache.maven.plugins 14 | maven-enforcer-plugin 15 | 3.0.0-M2 16 | 17 | 18 | default-cli 19 | 20 | enforce 21 | 22 | 23 | 24 | 25 | 26 | ${maven.version} 27 | 28 | 29 | ${java.version} 30 | 31 | 32 | 33 | 34 | 35 | bintray 36 | spring-milestones 37 | confluent 38 | projectlombok.org 39 | 40 | 41 | bintray 42 | spring-milestones 43 | confluent 44 | projectlombok.org 45 | 46 | 47 | 48 | 49 | No Snapshots Allowed in releases! 50 | ${enforcer.requireReleaseDeps.onlyWhenRelease} 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | com.google.guava:guava 59 | 60 | 61 | 62 | 63 | ${enforcer.searchTransitive} 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /tests/java-sample/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | io.github.efenglu.maven.tests 7 | tests 8 | 1.0.X-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | java-sample 13 | 14 | Java Sample Pom 15 | A complete Java sample project 16 | https://github.com/efenglu/maven 17 | 18 | 19 | https://github.com/efenglu/maven/issues 20 | GitHub Issues 21 | 22 | 23 | 24 | 25 | MIT License 26 | http://www.opensource.org/licenses/mit-license.php 27 | repo 28 | 29 | 30 | 31 | 32 | https://github.com/efenglu/maven 33 | scm:git:git://github.com/efenglu/maven.git 34 | scm:git:git@github.com:efenglu/maven.git 35 | 36 | 37 | 38 | UTF-8 39 | UTF-8 40 | 41 | 42 | 43 | 44 | org.projectlombok 45 | lombok 46 | 1.18.6 47 | provided 48 | 49 | 50 | org.spockframework 51 | spock-core 52 | 1.2-groovy-2.5 53 | test 54 | 55 | 56 | 57 | 58 | 59 | 60 | io.repaint.maven 61 | tiles-maven-plugin 62 | 2.12 63 | true 64 | 65 | 66 | io.github.efenglu.maven.tiles:project-java:${tile.version} 67 | 68 | 69 | 70 | 71 | org.apache.maven.plugins 72 | maven-dependency-plugin 73 | 3.1.1 74 | 75 | 76 | analyze 77 | 78 | analyze-only 79 | 80 | 81 | true 82 | true 83 | 84 | org.projectlombok:lombok:: 85 | org.spockframework:spock-core:: 86 | cglib:cglib-nodep:: 87 | org.objenesis:objenesis:: 88 | org.slf4j:slf4j-simple:: 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | release 100 | 101 | 102 | 103 | io.repaint.maven 104 | tiles-maven-plugin 105 | 2.12 106 | true 107 | 108 | 109 | io.github.efenglu.maven.tiles:gpg:${tile.version} 110 | io.github.efenglu.maven.tiles:nexus:${tile.version} 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | io.github.efenglu 8 | maven-parent 9 | pom 10 | 1.0.X-SNAPSHOT 11 | 12 | ${project.groupId}:${project.artifactId} 13 | Parent pom for the full featured parent pom demo 14 | https://github.com/efenglu/maven 15 | 16 | 17 | 18 | MIT License 19 | http://www.opensource.org/licenses/mit-license.php 20 | repo 21 | 22 | 23 | 24 | 25 | 26 | Erik Englund 27 | Github Efenglu 28 | https://github.com/efenglu 29 | 30 | 31 | 32 | 33 | scm:git:https://github.com/efenglu/maven.git 34 | scm:git:ssh://github.com/efenglu/maven.git 35 | https://github.com/efenglu/maven 36 | HEAD 37 | 38 | 39 | 40 | 41 | ossrh 42 | https://oss.sonatype.org/content/repositories/snapshots 43 | 44 | 45 | ossrh 46 | https://oss.sonatype.org/service/local/staging/deploy/maven2/ 47 | 48 | 49 | 50 | 51 | UTF-8 52 | UTF-8 53 | 54 | 55 | 56 | tiles 57 | checkstyle-config 58 | 59 | 60 | 61 | 62 | test 63 | 64 | tests 65 | 66 | 67 | 68 | release 69 | 70 | 71 | 72 | org.apache.maven.plugins 73 | maven-javadoc-plugin 74 | 3.0.0 75 | 76 | 77 | attach-javadocs 78 | 79 | jar 80 | 81 | 82 | 83 | 84 | 85 | org.apache.maven.plugins 86 | maven-source-plugin 87 | 3.0.1 88 | 89 | 90 | attach-sources 91 | 92 | jar 93 | 94 | 95 | 96 | 97 | 98 | org.apache.maven.plugins 99 | maven-gpg-plugin 100 | 1.6 101 | 102 | 103 | sign-artifacts 104 | verify 105 | 106 | sign 107 | 108 | 109 | 110 | 111 | 112 | org.sonatype.plugins 113 | nexus-staging-maven-plugin 114 | 1.6.8 115 | true 116 | 117 | ossrh 118 | https://oss.sonatype.org/ 119 | true 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2007-present the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import java.net.*; 17 | import java.io.*; 18 | import java.nio.channels.*; 19 | import java.util.Properties; 20 | 21 | public class MavenWrapperDownloader { 22 | 23 | private static final String WRAPPER_VERSION = "0.5.3"; 24 | /** 25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 26 | */ 27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + " .jar"; 29 | 30 | /** 31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 32 | * use instead of the default one. 33 | */ 34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 35 | ".mvn/wrapper/maven-wrapper.properties"; 36 | 37 | /** 38 | * Path where the maven-wrapper.jar will be saved to. 39 | */ 40 | private static final String MAVEN_WRAPPER_JAR_PATH = 41 | ".mvn/wrapper/maven-wrapper.jar"; 42 | 43 | /** 44 | * Name of the property which should be used to override the default download url for the wrapper. 45 | */ 46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 47 | 48 | public static void main(String args[]) { 49 | System.out.println("- Downloader started"); 50 | File baseDirectory = new File(args[0]); 51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 52 | 53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 54 | // wrapperUrl parameter. 55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 56 | String url = DEFAULT_DOWNLOAD_URL; 57 | if(mavenWrapperPropertyFile.exists()) { 58 | FileInputStream mavenWrapperPropertyFileInputStream = null; 59 | try { 60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 61 | Properties mavenWrapperProperties = new Properties(); 62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 64 | } catch (IOException e) { 65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 66 | } finally { 67 | try { 68 | if(mavenWrapperPropertyFileInputStream != null) { 69 | mavenWrapperPropertyFileInputStream.close(); 70 | } 71 | } catch (IOException e) { 72 | // Ignore ... 73 | } 74 | } 75 | } 76 | System.out.println("- Downloading from: " + url); 77 | 78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 79 | if(!outputFile.getParentFile().exists()) { 80 | if(!outputFile.getParentFile().mkdirs()) { 81 | System.out.println( 82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 83 | } 84 | } 85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 86 | try { 87 | downloadFileFromURL(url, outputFile); 88 | System.out.println("Done"); 89 | System.exit(0); 90 | } catch (Throwable e) { 91 | System.out.println("- Error downloading"); 92 | e.printStackTrace(); 93 | System.exit(1); 94 | } 95 | } 96 | 97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 99 | String username = System.getenv("MVNW_USERNAME"); 100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 101 | Authenticator.setDefault(new Authenticator() { 102 | @Override 103 | protected PasswordAuthentication getPasswordAuthentication() { 104 | return new PasswordAuthentication(username, password); 105 | } 106 | }); 107 | } 108 | URL website = new URL(urlString); 109 | ReadableByteChannel rbc; 110 | rbc = Channels.newChannel(website.openStream()); 111 | FileOutputStream fos = new FileOutputStream(destination); 112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 113 | fos.close(); 114 | rbc.close(); 115 | } 116 | 117 | } 118 | -------------------------------------------------------------------------------- /mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar" 124 | 125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( 126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 127 | ) 128 | 129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 131 | if exist %WRAPPER_JAR% ( 132 | echo Found %WRAPPER_JAR% 133 | ) else ( 134 | if not "%MVNW_REPOURL%" == "" ( 135 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar" 136 | ) 137 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 138 | echo Downloading from: %DOWNLOAD_URL% 139 | 140 | powershell -Command "&{"^ 141 | "$webclient = new-object System.Net.WebClient;"^ 142 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ 143 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ 144 | "}"^ 145 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ 146 | "}" 147 | echo Finished downloading %WRAPPER_JAR% 148 | ) 149 | @REM End of extension 150 | 151 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 152 | if ERRORLEVEL 1 goto error 153 | goto end 154 | 155 | :error 156 | set ERROR_CODE=1 157 | 158 | :end 159 | @endlocal & set ERROR_CODE=%ERROR_CODE% 160 | 161 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 162 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 163 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 164 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 165 | :skipRcPost 166 | 167 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 168 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 169 | 170 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 171 | 172 | exit /B %ERROR_CODE% 173 | -------------------------------------------------------------------------------- /mvnw: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # ---------------------------------------------------------------------------- 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # ---------------------------------------------------------------------------- 20 | 21 | # ---------------------------------------------------------------------------- 22 | # Maven2 Start Up Batch script 23 | # 24 | # Required ENV vars: 25 | # ------------------ 26 | # JAVA_HOME - location of a JDK home dir 27 | # 28 | # Optional ENV vars 29 | # ----------------- 30 | # M2_HOME - location of maven2's installed home dir 31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven 32 | # e.g. to debug Maven itself, use 33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files 35 | # ---------------------------------------------------------------------------- 36 | 37 | if [ -z "$MAVEN_SKIP_RC" ] ; then 38 | 39 | if [ -f /etc/mavenrc ] ; then 40 | . /etc/mavenrc 41 | fi 42 | 43 | if [ -f "$HOME/.mavenrc" ] ; then 44 | . "$HOME/.mavenrc" 45 | fi 46 | 47 | fi 48 | 49 | # OS specific support. $var _must_ be set to either true or false. 50 | cygwin=false; 51 | darwin=false; 52 | mingw=false 53 | case "`uname`" in 54 | CYGWIN*) cygwin=true ;; 55 | MINGW*) mingw=true;; 56 | Darwin*) darwin=true 57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home 58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html 59 | if [ -z "$JAVA_HOME" ]; then 60 | if [ -x "/usr/libexec/java_home" ]; then 61 | export JAVA_HOME="`/usr/libexec/java_home`" 62 | else 63 | export JAVA_HOME="/Library/Java/Home" 64 | fi 65 | fi 66 | ;; 67 | esac 68 | 69 | if [ -z "$JAVA_HOME" ] ; then 70 | if [ -r /etc/gentoo-release ] ; then 71 | JAVA_HOME=`java-config --jre-home` 72 | fi 73 | fi 74 | 75 | if [ -z "$M2_HOME" ] ; then 76 | ## resolve links - $0 may be a link to maven's home 77 | PRG="$0" 78 | 79 | # need this for relative symlinks 80 | while [ -h "$PRG" ] ; do 81 | ls=`ls -ld "$PRG"` 82 | link=`expr "$ls" : '.*-> \(.*\)$'` 83 | if expr "$link" : '/.*' > /dev/null; then 84 | PRG="$link" 85 | else 86 | PRG="`dirname "$PRG"`/$link" 87 | fi 88 | done 89 | 90 | saveddir=`pwd` 91 | 92 | M2_HOME=`dirname "$PRG"`/.. 93 | 94 | # make it fully qualified 95 | M2_HOME=`cd "$M2_HOME" && pwd` 96 | 97 | cd "$saveddir" 98 | # echo Using m2 at $M2_HOME 99 | fi 100 | 101 | # For Cygwin, ensure paths are in UNIX format before anything is touched 102 | if $cygwin ; then 103 | [ -n "$M2_HOME" ] && 104 | M2_HOME=`cygpath --unix "$M2_HOME"` 105 | [ -n "$JAVA_HOME" ] && 106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 107 | [ -n "$CLASSPATH" ] && 108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"` 109 | fi 110 | 111 | # For Mingw, ensure paths are in UNIX format before anything is touched 112 | if $mingw ; then 113 | [ -n "$M2_HOME" ] && 114 | M2_HOME="`(cd "$M2_HOME"; pwd)`" 115 | [ -n "$JAVA_HOME" ] && 116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" 117 | fi 118 | 119 | if [ -z "$JAVA_HOME" ]; then 120 | javaExecutable="`which javac`" 121 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then 122 | # readlink(1) is not available as standard on Solaris 10. 123 | readLink=`which readlink` 124 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then 125 | if $darwin ; then 126 | javaHome="`dirname \"$javaExecutable\"`" 127 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" 128 | else 129 | javaExecutable="`readlink -f \"$javaExecutable\"`" 130 | fi 131 | javaHome="`dirname \"$javaExecutable\"`" 132 | javaHome=`expr "$javaHome" : '\(.*\)/bin'` 133 | JAVA_HOME="$javaHome" 134 | export JAVA_HOME 135 | fi 136 | fi 137 | fi 138 | 139 | if [ -z "$JAVACMD" ] ; then 140 | if [ -n "$JAVA_HOME" ] ; then 141 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 142 | # IBM's JDK on AIX uses strange locations for the executables 143 | JAVACMD="$JAVA_HOME/jre/sh/java" 144 | else 145 | JAVACMD="$JAVA_HOME/bin/java" 146 | fi 147 | else 148 | JAVACMD="`which java`" 149 | fi 150 | fi 151 | 152 | if [ ! -x "$JAVACMD" ] ; then 153 | echo "Error: JAVA_HOME is not defined correctly." >&2 154 | echo " We cannot execute $JAVACMD" >&2 155 | exit 1 156 | fi 157 | 158 | if [ -z "$JAVA_HOME" ] ; then 159 | echo "Warning: JAVA_HOME environment variable is not set." 160 | fi 161 | 162 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher 163 | 164 | # traverses directory structure from process work directory to filesystem root 165 | # first directory with .mvn subdirectory is considered project base directory 166 | find_maven_basedir() { 167 | 168 | if [ -z "$1" ] 169 | then 170 | echo "Path not specified to find_maven_basedir" 171 | return 1 172 | fi 173 | 174 | basedir="$1" 175 | wdir="$1" 176 | while [ "$wdir" != '/' ] ; do 177 | if [ -d "$wdir"/.mvn ] ; then 178 | basedir=$wdir 179 | break 180 | fi 181 | # workaround for JBEAP-8937 (on Solaris 10/Sparc) 182 | if [ -d "${wdir}" ]; then 183 | wdir=`cd "$wdir/.."; pwd` 184 | fi 185 | # end of workaround 186 | done 187 | echo "${basedir}" 188 | } 189 | 190 | # concatenates all lines of a file 191 | concat_lines() { 192 | if [ -f "$1" ]; then 193 | echo "$(tr -s '\n' ' ' < "$1")" 194 | fi 195 | } 196 | 197 | BASE_DIR=`find_maven_basedir "$(pwd)"` 198 | if [ -z "$BASE_DIR" ]; then 199 | exit 1; 200 | fi 201 | 202 | ########################################################################################## 203 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 204 | # This allows using the maven wrapper in projects that prohibit checking in binary data. 205 | ########################################################################################## 206 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then 207 | if [ "$MVNW_VERBOSE" = true ]; then 208 | echo "Found .mvn/wrapper/maven-wrapper.jar" 209 | fi 210 | else 211 | if [ "$MVNW_VERBOSE" = true ]; then 212 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." 213 | fi 214 | if [ -n "$MVNW_REPOURL" ]; then 215 | jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar" 216 | else 217 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar" 218 | fi 219 | while IFS="=" read key value; do 220 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;; 221 | esac 222 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" 223 | if [ "$MVNW_VERBOSE" = true ]; then 224 | echo "Downloading from: $jarUrl" 225 | fi 226 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" 227 | if $cygwin; then 228 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` 229 | fi 230 | 231 | if command -v wget > /dev/null; then 232 | if [ "$MVNW_VERBOSE" = true ]; then 233 | echo "Found wget ... using wget" 234 | fi 235 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 236 | wget "$jarUrl" -O "$wrapperJarPath" 237 | else 238 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" 239 | fi 240 | elif command -v curl > /dev/null; then 241 | if [ "$MVNW_VERBOSE" = true ]; then 242 | echo "Found curl ... using curl" 243 | fi 244 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then 245 | curl -o "$wrapperJarPath" "$jarUrl" -f 246 | else 247 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f 248 | fi 249 | 250 | else 251 | if [ "$MVNW_VERBOSE" = true ]; then 252 | echo "Falling back to using Java to download" 253 | fi 254 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" 255 | # For Cygwin, switch paths to Windows format before running javac 256 | if $cygwin; then 257 | javaClass=`cygpath --path --windows "$javaClass"` 258 | fi 259 | if [ -e "$javaClass" ]; then 260 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 261 | if [ "$MVNW_VERBOSE" = true ]; then 262 | echo " - Compiling MavenWrapperDownloader.java ..." 263 | fi 264 | # Compiling the Java class 265 | ("$JAVA_HOME/bin/javac" "$javaClass") 266 | fi 267 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then 268 | # Running the downloader 269 | if [ "$MVNW_VERBOSE" = true ]; then 270 | echo " - Running MavenWrapperDownloader.java ..." 271 | fi 272 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") 273 | fi 274 | fi 275 | fi 276 | fi 277 | ########################################################################################## 278 | # End of extension 279 | ########################################################################################## 280 | 281 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} 282 | if [ "$MVNW_VERBOSE" = true ]; then 283 | echo $MAVEN_PROJECTBASEDIR 284 | fi 285 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" 286 | 287 | # For Cygwin, switch paths to Windows format before running java 288 | if $cygwin; then 289 | [ -n "$M2_HOME" ] && 290 | M2_HOME=`cygpath --path --windows "$M2_HOME"` 291 | [ -n "$JAVA_HOME" ] && 292 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` 293 | [ -n "$CLASSPATH" ] && 294 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"` 295 | [ -n "$MAVEN_PROJECTBASEDIR" ] && 296 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` 297 | fi 298 | 299 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 300 | 301 | exec "$JAVACMD" \ 302 | $MAVEN_OPTS \ 303 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ 304 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ 305 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" 306 | -------------------------------------------------------------------------------- /checkstyle-config/src/main/resources/checkstyle.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 67 | 68 | 69 | 70 | 71 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 82 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 131 | 133 | 135 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 184 | 185 | 186 | 187 | 188 | 189 | 192 | 193 | 194 | 196 | 197 | 198 | 199 | 200 | 201 | 204 | 205 | 206 | 207 | 208 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 268 | 269 | 270 | 271 | 272 | 273 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 303 | 304 | 305 | 306 | 307 | 308 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | -------------------------------------------------------------------------------- /medium.md: -------------------------------------------------------------------------------- 1 | # Writing a Full Featured Maven Pom 2 | 3 | ## Parts of a POM 4 | Maven is a build tool with a structured build pipeline. It alloys extensive 5 | customization for your own needs. You can get a build going with very little 6 | in your pom. But a good build, that follows everything you should probably 7 | do within a CI/CD pipeline takes a bit more. 8 | 9 | ## Basic Information 10 | Every project should describe itself. 11 | 12 | For maven this means defining at a bare minimum: 13 | ```xml 14 | 15 | com.efenglu.examplePom 16 | example.pom 17 | 1.0.X-SNAPSHOT 18 | 19 | ``` 20 | 21 | But you should really also include: 22 | * Name 23 | - Human readable name for the project 24 | * Description 25 | - More human stuff about your project 26 | * URL 27 | - Main url to go to for information about the project, typically same as scm url but not always 28 | * Issue Management 29 | - Where users can go if they have problems 30 | * Licenses 31 | - WHat License governs the use of your code 32 | * SCM 33 | - Where is the code stored 34 | 35 | Example: 36 | ```xml 37 | 38 | com.efenglu.examplePom 39 | example.pom 40 | 1.0.X-SNAPSHOT 41 | 42 | Full Featured Maven Pom Example 43 | Project to a complete set of plugins for development 44 | https://github.com/efenglu/maven 45 | 46 | 47 | https://github.com/efenglu/maven/issues 48 | GitHub Issues 49 | 50 | 51 | 52 | 53 | MIT License 54 | http://www.opensource.org/licenses/mit-license.php 55 | repo 56 | 57 | 58 | 59 | 60 | https://github.com/efenglu/maven 61 | scm:git:git://github.com/efenglu/maven.git 62 | scm:git:git@github.com:efenglu/maven.git 63 | 64 | 65 | ``` 66 | 67 | ## Encoding 68 | Maven needs to how it should treat your text. This is done through project enoding. 69 | 70 | Almost always this is UTF-8: 71 | ```xml 72 | 73 | 74 | UTF-8 75 | UTF-8 76 | 77 | 78 | ``` 79 | 80 | ## Compiler 81 | Now that we have the basics we need to get to coding, and by coding we of course mean compiling. 82 | 83 | ### Javac 84 | By default the javac compiler is basically all setup. But, there are a few housekeeping things we need to do 85 | 86 | * Choose which version of java the source and compiled classes we will target 87 | * Include debugging flags? 88 | * Any other javac flags or custom arguments 89 | 90 | For most of our projects we follow a pretty simple pattern: 91 | ```xml 92 | 93 | 94 | 1.8 95 | false 96 | false 97 | true 98 | true 99 | 3.7.0 100 | 101 | 102 | 103 | 104 | 105 | org.apache.maven.plugins 106 | maven-compiler-plugin 107 | ${maven-compiler-plugin.version} 108 | 109 | ${java.optimize} 110 | ${java.debug} 111 | ${java.version} 112 | ${java.version} 113 | ${java.showDeprecation} 114 | ${java.showWarnings} 115 | 116 | 117 | 118 | 119 | 120 | ``` 121 | Further Reading 122 | * [Apache Maven Compiler Plugin](https://maven.apache.org/plugins/maven-compiler-plugin/) 123 | 124 | ### Groovy 125 | For most of our projects we use the Spock testing framework. This means we need to compile groovy code 126 | in order to run the tests. 127 | 128 | We have tried all sorts of groovy compilers. Each has their advantages and disadvantages. For now we 129 | have chosen GMavenPlus. 130 | 131 | ```xml 132 | 133 | 134 | 135 | 136 | org.codehaus.gmavenplus 137 | gmavenplus-plugin 138 | 1.6.2 139 | 140 | 141 | 142 | compileTests 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | ``` 151 | 152 | Further Reading 153 | * [GMavenPlus](https://github.com/groovy/GMavenPlus) 154 | 155 | ### Lombok 156 | Lombok is a great way to reduce code complexity in Java. We use it extensively when creating our POJO's 157 | 158 | For the most part, simply including lombok as a **provided** dependency *should* be enough. 159 | 160 | ```xml 161 | 162 | 163 | org.projectlombok 164 | lombok 165 | 1.18.1 166 | provided 167 | 168 | 169 | ``` 170 | 171 | Further Reading: 172 | * [Lombok](https://projectlombok.org) 173 | * [Lombok Maven](https://projectlombok.org/setup/maven) 174 | 175 | ## Code Generation 176 | This is more of an optional section. T 177 | 178 | here are many tools that *assist* you by generating code 179 | for you at build time. There are several different examples of this. 180 | 181 | We will focus on: 182 | * Protobuf 183 | 184 | ### Protobuf 185 | Protocol buffers is a fast growing binary interchange format originally written by Google. Protocol buffers 186 | are defined in **.proto** files. These are then *compiled* into various languages. Here is how 187 | we go about *compiling* our proto files. 188 | 189 | ```xml 190 | 191 | 192 | 193 | 194 | 0.6.1 195 | 1.18.0 196 | 197 | 198 | 199 | 200 | 201 | src/main/proto 202 | 203 | 204 | src/main/resources 205 | 206 | 207 | 208 | 209 | 210 | kr.motd.maven 211 | os-maven-plugin 212 | 1.6.1 213 | true 214 | 215 | 216 | initialize 217 | 218 | detect 219 | 220 | 221 | 222 | 223 | 224 | org.xolstice.maven.plugins 225 | protobuf-maven-plugin 226 | ${protobuf.plugin.version} 227 | 228 | true 229 | com.google.protobuf:protoc:3.6.1:exe:${os.detected.classifier} 230 | 231 | 232 | 233 | protobuf.java 234 | 235 | compile 236 | 237 | generate-sources 238 | 239 | 240 | protobuf.grpc-java 241 | 242 | compile-custom 243 | 244 | generate-sources 245 | 246 | grpc-java 247 | io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier} 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | ``` 256 | 257 | The os-maven-plugin will detect our build environment platform. This is then used in determining which 258 | platform specific protoc executable to download. The protobuf-maven-plugin then uses that executable 259 | to compile the actual *.proto* files into java code. 260 | 261 | Further Reading: 262 | * [Protocol Buffers](https://developers.google.com/protocol-buffers/) 263 | * [Maven Protobuf Plugin](https://www.xolstice.org/protobuf-maven-plugin/) 264 | 265 | ## Unit Tests 266 | 267 | Good units tests are critical to the future, and present, of any successful project. 268 | 269 | Thankfully, setting up units tests is fairly easy: 270 | 271 | ```xml 272 | 273 | 274 | 275 | 276 | 2.20 277 | 278 | 279 | 280 | 281 | 282 | org.apache.maven.plugins 283 | maven-surefire-plugin 284 | ${maven-surefire-plugin.version} 285 | 286 | 287 | **/*Spec.* 288 | **/*Specs.* 289 | **/*Test.* 290 | **/*Tests.* 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | org.apache.maven.plugins 301 | maven-surefire-report-plugin 302 | ${maven-surefire-plugin.version} 303 | 304 | 305 | 306 | 307 | 308 | ``` 309 | 310 | You may have noticed the includes elements. We enforce a naming standard for our tests. They must end in 311 | either "Test", "Tests" for JUnit tests or "Spec", "Specs" or Spock Specifications. 312 | 313 | Further Reading: 314 | * [Maven Surefire Plugin](https://maven.apache.org/surefire/maven-surefire-plugin/index.html) 315 | 316 | ## Code Coverage 317 | Ensuring code is actually tested is critical. A good metric to determine if code has been tested is Code Coverage. 318 | It is not a perfect metric and you should probably never require 100% coverage. But it is a great way to ensure 319 | at least some level of compliance with testing. But then again we all follow TDD to a tee and this shouldn't be 320 | a problem, right? 321 | 322 | There are two big players when it comes to code coverage, Jacoco and Cobertura. We use Jacoco. 323 | 324 | ```xml 325 | 326 | 327 | 328 | 329 | 0.8.3 330 | 0.70 331 | 332 | 333 | 334 | 335 | 336 | org.jacoco 337 | jacoco-maven-plugin 338 | ${jacoco.version} 339 | 340 | 341 | jacoco-initialize 342 | initialize 343 | 344 | prepare-agent 345 | 346 | 347 | 348 | jacoco-check 349 | test 350 | 351 | check 352 | 353 | 354 | 355 | 356 | BUNDLE 357 | 358 | **/altova/**/*.* 359 | **/*Spec.* 360 | **/*Specs.* 361 | **/*Test.* 362 | **/*Tests.* 363 | 364 | 365 | 366 | INSTRUCTION 367 | COVEREDRATIO 368 | ${jacoco.bundle.coveredratio.minimum} 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | jacoco-site 377 | verify 378 | 379 | report 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | ``` 388 | 389 | We enforce code coverage of 70%. 390 | 391 | Further Reading: 392 | * [Jacoco Maven Plugin](https://www.eclemma.org/jacoco/trunk/doc/maven.html) 393 | 394 | ## Integration Tests 395 | Some tests take longer than others. Some tests are more complicated and require more setup and resources. 396 | These are great example of integration tests. Most integration tests are run later in the build process. 397 | Sometime integration are not run at all on developer workstations. 398 | 399 | We follow a pattern of placing integration tests into a *src/it/java* path structure. 400 | 401 | This separates the integration tests from the regular tests. However, since maven doesn't **really** 402 | recognize the concept of integration tests it is also necessary to name the tests differently since all the tests 403 | get compiled into a single test class classpath. 404 | 405 | For our project all integration tests must end in **IT**. 406 | 407 | ```xml 408 | 409 | 410 | 411 | 412 | 413 | 414 | org.apache.maven.plugins 415 | maven-failsafe-plugin 416 | 417 | ${it.skip} 418 | 419 | **/*IT.* 420 | 421 | 422 | 423 | 424 | integration-test 425 | 426 | integration-test 427 | verify 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | org.apache.maven.plugins 439 | maven-surefire-report-plugin 440 | 441 | 442 | integration-tests 443 | 444 | failsafe-report-only 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | ``` 454 | 455 | ## Static Code Analysis 456 | Statis code analysis is another way to prevent bugs from happening. You can scan your codebase for common programming 457 | mistakes and catch them early. You can also ensure a level of code quality and coding standards to ensure the code 458 | is easy to read. 459 | 460 | There are lots of different SCA tools: 461 | * [Checkstyle](https://maven.apache.org/plugins/maven-checkstyle-plugin/) 462 | * [PMD](https://maven.apache.org/plugins/maven-pmd-plugin/) 463 | * [CPD](https://maven.apache.org/plugins/maven-pmd-plugin/cpd-mojo.html) 464 | * [Spotbugs](https://spotbugs.github.io) (Successor to Findbugs) 465 | * [Codenarc](https://gleclaire.github.io/codenarc-maven-plugin/) 466 | * etc. 467 | 468 | For now we will focus on Checkstyle as an example. 469 | 470 | ### Checkstyle 471 | Checkstyle enforces code formatting and checks for some very basic bad programming practices. 472 | 473 | ```xml 474 | 475 | 476 | 477 | true 478 | true 479 | false 480 | 2.17 481 | 6.19 482 | 1.0.X-SNAPSHOT 483 | 484 | 485 | 486 | 487 | 488 | 489 | org.apache.maven.plugins 490 | maven-checkstyle-plugin 491 | ${maven-checkstyle-plugin.version} 492 | 493 | 494 | io.github.efenglu 495 | checkstyle-config 496 | ${checkstyle.config.version} 497 | 498 | 499 | com.puppycrawl.tools 500 | checkstyle 501 | ${checkstyle.version} 502 | 503 | 504 | 505 | checkstyle.xml 506 | ${project.build.sourceEncoding} 507 | 508 | 509 | 510 | 511 | 512 | 513 | org.apache.maven.plugins 514 | maven-checkstyle-plugin 515 | 516 | 517 | verify-checkstyle 518 | verify 519 | 520 | check 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | org.apache.maven.plugins 532 | maven-checkstyle-plugin 533 | ${maven-checkstyle-plugin.version} 534 | 535 | 536 | 537 | checkstyle 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | ``` 547 | 548 | #### Things of Note 549 | We configure checkstyle in the plugin management section to ensure if the user invokes checkstyle from the command 550 | line then they will get the correct configuration. 551 | 552 | It is also recommended that you define your own checkstyle configuration. You should deploy this as its own artifact 553 | and consume it in the checkstyle plugin. You can see where I defined my own version in the dependency I added to the 554 | checkstyle plugin. This jar is available to checkstyle on the classpath and you can load a resource from that jar 555 | using *configLocation* element. 556 | 557 | ## Maven Enforcer 558 | Just like there is SCA for code the Maven Enforcer is a kind of static code analysis of your maven poms. 559 | 560 | We use the enforcer to ensure: 561 | * requireMavenVersion: 3.5.0 562 | * requireJavaVersion: 1.8.0 563 | * requireNoRepositories: No other repository elements in our poms 564 | * requireReleaseDeps: We don't reference a snapshot artifact in a release artifact 565 | * requireUpperBoundDeps: We don't have version conflicts in our dependencies 566 | 567 | ```xml 568 | 569 | 570 | 571 | 3.5.0 572 | true 573 | 1.8 574 | true 575 | 576 | 577 | 578 | 579 | 580 | org.apache.maven.plugins 581 | maven-enforcer-plugin 582 | 583 | 584 | default-cli 585 | 586 | enforce 587 | 588 | 589 | 590 | 591 | 592 | ${maven.version} 593 | 594 | 595 | ${java.version} 596 | 597 | 598 | 599 | 600 | 601 | bintray 602 | spring-milestones 603 | confluent 604 | projectlombok.org 605 | 606 | 607 | bintray 608 | spring-milestones 609 | confluent 610 | projectlombok.org 611 | 612 | 613 | 614 | 615 | No Snapshots Allowed in releases! 616 | ${enforcer.requireReleaseDeps.onlyWhenRelease} 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | com.google.guava:guava 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | ``` 637 | 638 | Further reading: 639 | * [Maven Enforcer Plugin](https://maven.apache.org/enforcer/maven-enforcer-plugin/) 640 | 641 | ## Maven Dependency Analyzer 642 | As the number of dependencies grows is becomes necessary to check our dependencies. 643 | * Are we still using them? 644 | * Does our code import classes from transitive dependencies? 645 | - This is generally a bad idea. If the library that is providing that transitie dependency remove that dependency 646 | we may suddenly not be able to compile ours. In general, if you have a dependency you should also call it out. 647 | 648 | ```xml 649 | 650 | 651 | 652 | 653 | 654 | maven-dependency-plugin 655 | 656 | 657 | analyze 658 | 659 | analyze-only 660 | 661 | 662 | true 663 | true 664 | 665 | cglib:cglib-nodep:: 666 | org.objenesis:objenesis:: 667 | org.slf4j:slf4j-simple:: 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | ``` 678 | 679 | ## Packaging 680 | Maven already adds several things to the Manifest files that are created. But we should probably add a few others. 681 | 682 | ```xml 683 | 684 | 685 | 686 | 687 | false 688 | 689 | 690 | 691 | 692 | 693 | pl.project13.maven 694 | git-commit-id-plugin 695 | 696 | true 697 | true 698 | true 699 | ${project.build.outputDirectory}/git.properties 700 | ${failOnNoGitDirectory} 701 | 702 | 703 | 704 | get-the-git-infos 705 | 706 | revision 707 | 708 | validate 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | ``` 717 | 718 | ## Source Jar 719 | When you publish you code to a artifact repository its important to also publish a source jar along with it. 720 | This will allow consumers to view your code easily. 721 | 722 | ```xml 723 | 724 | 725 | 726 | 727 | 728 | 729 | org.apache.maven.plugins 730 | maven-source-plugin 731 | 3.0.1 732 | 733 | 734 | attach-sources 735 | package 736 | 737 | jar-no-fork 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | ``` 747 | 748 | Further Reading: 749 | * [Maven Source Plugin](https://maven.apache.org/plugins/maven-source-plugin/) 750 | 751 | ## Jar Signing 752 | TK 753 | 754 | ## Fat Jar? 755 | Sometimes it becomes necessary to rollup all your dependencies into a single jar file. This can be useful 756 | when running scripts. Fat jars also have dis-advantages. You can have problems with class path conflicts, file 757 | duplication and other files colliding, 758 | 759 | None of the tools for building fat jars are perfect but I've had the best luck with the shader plugin. One 760 | thing it does really well is compile spring, and services files. These files usually reside in a jar's MANIFEST 761 | folder. But when building a fat jar they will often collide causing you to loose some necessary configuration 762 | information. The Shader plugin will avoid this my merging and combining these files as best as it can. 763 | 764 | ```xml 765 | 766 | 767 | 768 | 769 | 770 | 771 | org.apache.maven.plugins 772 | maven-shade-plugin 773 | 774 | 775 | 776 | 777 | META-INF/spring.handlers 778 | 779 | 780 | META-INF/spring.schemas 781 | 782 | 783 | META-INF/spring.tooling 784 | 785 | 786 | 787 | ${project.name} Fat Jar 788 | ${project.version} 789 | ${project.groupId}.${project.artifactId} 790 | 791 | 792 | 793 | 794 | 795 | *:* 796 | 797 | META-INF/*.SF 798 | META-INF/*.DSA 799 | META-INF/*.RSA 800 | 801 | 802 | 803 | 804 | 805 | 806 | jar-with-dependencies 807 | package 808 | 809 | shade 810 | 811 | 812 | jar-with-dependencies 813 | true 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | ``` 824 | 825 | 826 | 827 | ## Sharing Configuration 828 | Ok, so that's a lot. Your pom is probably well over 1000 lines long now. Not only that its very complicated and 829 | hard to reproduce. Sure it does **everything** we want it to but what good it that if we can't easily maintain 830 | the configuration across lots of projects. 831 | 832 | There are really two ways to go about doing this. Neither is perfect but together they can get pretty close. 833 | 834 | ### Parent Poms 835 | Maven support the concept of inheritance of poms. You can do this easily by specifying a *parent* element in your pom. 836 | 837 | ```xml 838 | 839 | tiles-parent 840 | io.github.efenglu.maven.tiles 841 | 1.0.X-SNAPSHOT 842 | 843 | ``` 844 | 845 | The child will now receive all the configuration from the parent. You can override settings in the child and 846 | add additional to your hearts content. 847 | 848 | Parents are also a great place to setup *dependencyManagement* and *pluginManagement* sections. This ensures all 849 | your child modules will use the same version of a dependency and the same version of a plugin in their build. 850 | 851 | Some things to be aware of. Its difficult to exclude something. Meaning if the parent defines a plugin its 852 | not very easy for the child to turn that plugin off. Therefore, be careful about adding ALL your configuration into 853 | a single monster parent. 854 | 855 | That's where the second approach becomes useful 856 | 857 | ## Tiles 858 | Maven doesn't natively support a concept of composition of configuration. But a third party tool, known as 859 | [Maven Tiles](https://github.com/repaint-io/maven-tiles) brings that capability. 860 | 861 | Maven tiles allow you to compose in project configuration: 862 | ```xml 863 | 864 | io.repaint.maven 865 | tiles-maven-plugin 866 | 2.12 867 | true 868 | 869 | 870 | io.repaint.tiles:github-release-tile:[1.1, 2) 871 | io.github.efenglu.maven.tiles:checkstyle:[1.0, 2) 872 | 873 | 874 | 875 | ``` 876 | 877 | *Note:* You can not use tiles in a parent as a way for all the children to get the tile. It doesn't work that 878 | way. Tiles are mean to be used directly where they are needed. 879 | 880 | ## Tiles of Tiles 881 | Instead of having to list all the tiles you want a particular module to use everytime, if there are a set of common 882 | tiles you like your can create another tile that composes that tiles as a single tile. 883 | 884 | ## Parent Pom's And Tiles 885 | I recommend you put *some* common configuration in your parent poms. 886 | 887 | **DO** include in your parent pom: 888 | * Basic Project configuration (scm, url, issuement management etc) 889 | * pluginManagement 890 | * dependencyManagement 891 | * encoding 892 | 893 | **DO NOT** include in your parent pom: 894 | * dependencies 895 | * tiles 896 | 897 | **DO** Use tiles on all your leaf projects to configure the build as needed in a repeatable way. 898 | 899 | ## Finished Example 900 | Now that we have our tiles and some parent poms we have lots of wonderful features to help us be great 901 | programmers, active members of the community flexibilty for the future. 902 | 903 | ```xml 904 | 905 | ``` 906 | 907 | ## Flattening 908 | Now that you have your set of parents and all your plugins you have one last anoyance. If someone goes 909 | to use your library as it stands they will also have to download all your parent poms. On top of that, all your 910 | poms that you deployed to your artifact repository will still contain all your build configuration. 911 | 912 | In order to clean up those poms and eliminate the need to download the parents we can *flatten* a pom. 913 | 914 | Flattening a pom brings all the dependencies into a single pom. It also removes a lot of unnecessary information from 915 | the pom when it is deployed. Things like, plugins, properties, reporting etc. 916 | 917 | ```xml 918 | 919 | 920 | 921 | 922 | 923 | 924 | 925 | 926 | 927 | 928 | org.codehaus.mojo 929 | flatten-maven-plugin 930 | 1.0.1 931 | 932 | 933 | 934 | 935 | 936 | 937 | 938 | 939 | 940 | 941 | ${flatten.mode} 942 | true 943 | 944 | 945 | 946 | 947 | flatten 948 | process-resources 949 | 950 | flatten 951 | 952 | 953 | 954 | 955 | flatten.clean 956 | clean 957 | 958 | clean 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | ``` 968 | 969 | Further Reading: 970 | * [Flatten Maven Plugin](https://www.mojohaus.org/flatten-maven-plugin/) 971 | 972 | # Conclusion 973 | We covered LOTS of stuff here and only scratched the surface of how you can customize the plugins we mentioned here. 974 | Hopefully, this provides a building block for your own maven endeavors. 975 | 976 | Don't forget to checkout all the code mentioned along with complete example and tiles for each plugin at my 977 | github repo, [efenglu/maven](https://github.com/efenglu/maven) --------------------------------------------------------------------------------