Skip to content

Instantly share code, notes, and snippets.

@aalmiray
Last active February 1, 2021 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aalmiray/dbf54ea12333f295d5af7d11d8adaa53 to your computer and use it in GitHub Desktop.
Save aalmiray/dbf54ea12333f295d5af7d11d8adaa53 to your computer and use it in GitHub Desktop.
Maven incremental build
$ gm --version
Using maven at '/tmp/sample/mvnw' to run buildFile '/tmp/sample/pom.xml':
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/aalmiray/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 1.8.0_272, vendor: Amazon.com Inc., runtime: /Users/aalmiray/.sdkman/candidates/java/8.0.272-amzn/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"
aalmiray2:sample aalmiray$ tree .
.
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
└── main
└── java
└── com
└── acme
└── Phantom.java
5 directories, 4 files
aalmiray2:sample aalmiray$ cat pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.acme</groupId>
<artifactId>example</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
aalmiray2:sample aalmiray$ gm verify
Using maven at '/tmp/sample/mvnw' to run buildFile '/tmp/sample/pom.xml':
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.acme:example >--------------------------
[INFO] Building example 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/sample/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ example ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /tmp/sample/target/classes
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/sample/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ example ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ example ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ example ---
[INFO] Building jar: /tmp/sample/target/example-1.0.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.964 s
[INFO] Finished at: 2021-02-01T15:29:36+01:00
[INFO] ------------------------------------------------------------------------
aalmiray2:sample aalmiray$ tree target/
target/
├── classes
│   └── com
│   └── acme
│   └── Phantom.class
├── example-1.0.0-SNAPSHOT.jar
├── generated-sources
│   └── annotations
├── maven-archiver
│   └── pom.properties
└── maven-status
└── maven-compiler-plugin
└── compile
└── default-compile
├── createdFiles.lst
└── inputFiles.lst
10 directories, 5 files
aalmiray2:sample aalmiray$ unzip -l target/example-1.0.0-SNAPSHOT.jar
Archive: target/example-1.0.0-SNAPSHOT.jar
Length Date Time Name
--------- ---------- ----- ----
0 02-01-2021 15:29 META-INF/
134 02-01-2021 15:29 META-INF/MANIFEST.MF
0 02-01-2021 15:29 com/
0 02-01-2021 15:29 com/acme/
264 02-01-2021 15:29 com/acme/Phantom.class
0 02-01-2021 15:29 META-INF/maven/
0 02-01-2021 15:29 META-INF/maven/com.acme/
0 02-01-2021 15:29 META-INF/maven/com.acme/example/
1840 02-01-2021 15:29 META-INF/maven/com.acme/example/pom.xml
109 02-01-2021 15:29 META-INF/maven/com.acme/example/pom.properties
--------- -------
2347 10 files
aalmiray2:sample aalmiray$ mkdir tmp
aalmiray2:sample aalmiray$ mv src/main/java/com/acme/Phantom.java tmp
aalmiray2:sample aalmiray$ gm verify
Using maven at '/tmp/sample/mvnw' to run buildFile '/tmp/sample/pom.xml':
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.acme:example >--------------------------
[INFO] Building example 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/sample/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ example ---
[INFO] Changes detected - recompiling the module!
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ example ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/sample/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ example ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ example ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ example ---
[INFO] Building jar: /tmp/sample/target/example-1.0.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.797 s
[INFO] Finished at: 2021-02-01T15:30:22+01:00
[INFO] ------------------------------------------------------------------------
aalmiray2:sample aalmiray$ tree target/
target/
├── classes
│   └── com
│   └── acme
├── example-1.0.0-SNAPSHOT.jar
├── generated-sources
│   └── annotations
├── maven-archiver
│   └── pom.properties
└── maven-status
└── maven-compiler-plugin
└── compile
└── default-compile
├── createdFiles.lst
└── inputFiles.lst
10 directories, 4 files
aalmiray2:sample aalmiray$ unzip -l target/example-1.0.0-SNAPSHOT.jar
Archive: target/example-1.0.0-SNAPSHOT.jar
Length Date Time Name
--------- ---------- ----- ----
0 02-01-2021 15:30 META-INF/
134 02-01-2021 15:30 META-INF/MANIFEST.MF
0 02-01-2021 15:29 com/
0 02-01-2021 15:30 com/acme/
0 02-01-2021 15:30 META-INF/maven/
0 02-01-2021 15:30 META-INF/maven/com.acme/
0 02-01-2021 15:30 META-INF/maven/com.acme/example/
1840 02-01-2021 15:29 META-INF/maven/com.acme/example/pom.xml
109 02-01-2021 15:29 META-INF/maven/com.acme/example/pom.properties
--------- -------
2083 9 files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment