diff --git a/.github/workflows/deploy-documentation.yml b/.github/workflows/deploy-documentation.yml
index 88519ab65..780cf9550 100644
--- a/.github/workflows/deploy-documentation.yml
+++ b/.github/workflows/deploy-documentation.yml
@@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- graalvm-version: [ dev ]
+ graalvm-version: [ latest ]
java-version: [ 11 ]
os: [ ubuntu-20.04 ]
steps:
diff --git a/.github/workflows/deploy-snapshots.yml b/.github/workflows/deploy-snapshots.yml
index cd460ed8f..196b77f2c 100644
--- a/.github/workflows/deploy-snapshots.yml
+++ b/.github/workflows/deploy-snapshots.yml
@@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- graalvm-version: [ dev ]
+ graalvm-version: [ latest ]
java-version: [ 11 ]
os: [ ubuntu-20.04 ]
steps:
diff --git a/.github/workflows/test-native-gradle-plugin.yml b/.github/workflows/test-native-gradle-plugin.yml
index 2e6ceefdc..e2ddc2116 100644
--- a/.github/workflows/test-native-gradle-plugin.yml
+++ b/.github/workflows/test-native-gradle-plugin.yml
@@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- graalvm-version: [ dev ]
+ graalvm-version: [ latest ] # dev
java-version: [ 11 ]
os: [ ubuntu-20.04 ]
steps:
@@ -53,8 +53,10 @@ jobs:
strategy:
fail-fast: false
matrix:
- gradle-version: ["current", "7.3.3", "7.2", "7.1", "6.8.3", "6.7.1"]
- graalvm-version: [ dev ]
+ gradle-version: ["current", "6.7.1"]
+ # Following versions are disabled temporarily in order to speed up PR testing
+ # "7.3.3", "7.2", "7.1", "6.8.3"
+ graalvm-version: [ latest ] # dev
java-version: [ 11 ]
os: [ ubuntu-20.04 ]
steps:
@@ -81,7 +83,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- graalvm-version: [ dev ]
+ graalvm-version: [ latest ]
java-version: [ 11 ]
os: [ windows-latest ]
steps:
diff --git a/.github/workflows/test-native-maven-plugin.yml b/.github/workflows/test-native-maven-plugin.yml
index 4d9c96548..afff175c8 100644
--- a/.github/workflows/test-native-maven-plugin.yml
+++ b/.github/workflows/test-native-maven-plugin.yml
@@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- graalvm-version: [ dev ]
+ graalvm-version: [ latest ] # dev
java-version: [ 11 ]
os: [ ubuntu-20.04 ]
steps:
@@ -55,7 +55,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- graalvm-version: [ dev ]
+ graalvm-version: [ latest ] # dev
java-version: [ 11 ]
os: [ windows-latest ]
steps:
diff --git a/docs/src/docs/asciidoc/announcement.adoc b/docs/src/docs/asciidoc/announcement.adoc
index 1eab3490c..24f797cf1 100644
--- a/docs/src/docs/asciidoc/announcement.adoc
+++ b/docs/src/docs/asciidoc/announcement.adoc
@@ -144,7 +144,7 @@ Adding our new plugin to the existing _Maven_ project requires adding the follow
build-native
- build
+ compile-no-fork
package
diff --git a/docs/src/docs/asciidoc/maven-plugin.adoc b/docs/src/docs/asciidoc/maven-plugin.adoc
index 5e6aa41fd..ba44a6b40 100644
--- a/docs/src/docs/asciidoc/maven-plugin.adoc
+++ b/docs/src/docs/asciidoc/maven-plugin.adoc
@@ -40,7 +40,7 @@ Add the following profile to your `pom.xml` file to register the `native-maven-p
build-native
- build
+ compile-no-fork
package
diff --git a/native-maven-plugin/reproducers/issue-144/pom.xml b/native-maven-plugin/reproducers/issue-144/pom.xml
index e45bcdeca..0b1b3076b 100644
--- a/native-maven-plugin/reproducers/issue-144/pom.xml
+++ b/native-maven-plugin/reproducers/issue-144/pom.xml
@@ -92,7 +92,7 @@
build-native
- build
+ compile-no-fork
package
diff --git a/native-maven-plugin/src/functionalTest/groovy/org/graalvm/buildtools/maven/JavaApplicationFunctionalTest.groovy b/native-maven-plugin/src/functionalTest/groovy/org/graalvm/buildtools/maven/JavaApplicationFunctionalTest.groovy
index 8f08c22b0..caa8b3b7c 100644
--- a/native-maven-plugin/src/functionalTest/groovy/org/graalvm/buildtools/maven/JavaApplicationFunctionalTest.groovy
+++ b/native-maven-plugin/src/functionalTest/groovy/org/graalvm/buildtools/maven/JavaApplicationFunctionalTest.groovy
@@ -49,13 +49,13 @@ class JavaApplicationFunctionalTest extends AbstractGraalVMMavenFunctionalTest {
when:
mvn '-Pnative', '-DskipTests', '-DnativeDryRun', '-DuseArgFile=false',
- '-Dclasspath=/testcp', '-Ddebug', '-Dfallback=false', '-Dverbose', '-DsharedLibrary',
+ '-Dclasspath=/', '-Ddebug', '-Dfallback=false', '-Dverbose', '-DsharedLibrary',
'-DquickBuild',
'package'
then:
buildSucceeded
- outputContains "native-image -cp /testcp -g --no-fallback --verbose --shared -Ob"
+ outputContains "native-image -cp / -g --no-fallback --verbose --shared -Ob"
}
def "can build and execute a native image with the Maven plugin"() {
diff --git a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/AbstractNativeMojo.java b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/AbstractNativeMojo.java
index a55b604d6..67162aabd 100644
--- a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/AbstractNativeMojo.java
+++ b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/AbstractNativeMojo.java
@@ -277,7 +277,11 @@ protected List getBuildArgs() throws MojoExecutionException {
return Collections.unmodifiableList(cliArgs);
}
- protected Path processArtifact(Artifact artifact, String artifactType) throws MojoExecutionException {
+ protected Path processSupportedArtifacts(Artifact artifact) throws MojoExecutionException {
+ return processArtifact(artifact, "jar", "test-jar", "war");
+ }
+
+ protected Path processArtifact(Artifact artifact, String... artifactTypes) throws MojoExecutionException {
File artifactFile = artifact.getFile();
if (artifactFile == null) {
@@ -285,8 +289,8 @@ protected Path processArtifact(Artifact artifact, String artifactType) throws Mo
return null;
}
- if (!artifactType.equals(artifact.getType())) {
- logger.warn("Ignoring non-jar type ImageClasspath Entry " + artifact);
+ if (Arrays.stream(artifactTypes).noneMatch(a -> a.equals(artifact.getType()))) {
+ logger.warn("Ignoring ImageClasspath Entry '" + artifact + "' with unsupported type '" + artifact.getType() + "'");
return null;
}
if (!artifactFile.exists()) {
@@ -302,7 +306,7 @@ protected Path processArtifact(Artifact artifact, String artifactType) throws Mo
}
protected void addArtifactToClasspath(Artifact artifact) throws MojoExecutionException {
- Optional.ofNullable(processArtifact(artifact, "jar")).ifPresent(imageClasspath::add);
+ Optional.ofNullable(processSupportedArtifacts(artifact)).ifPresent(imageClasspath::add);
}
protected void warnIfWrongMetaInfLayout(Path jarFilePath, Artifact artifact) throws MojoExecutionException {
@@ -380,6 +384,7 @@ protected void populateClasspath() throws MojoExecutionException {
populateApplicationClasspath();
addDependenciesToClasspath();
}
+ imageClasspath.removeIf(entry -> !entry.toFile().exists());
}
protected String getClasspath() throws MojoExecutionException {
diff --git a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/DeprecatedNativeBuildMojo.java b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/DeprecatedNativeBuildMojo.java
new file mode 100644
index 000000000..60d86b80e
--- /dev/null
+++ b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/DeprecatedNativeBuildMojo.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * The Universal Permissive License (UPL), Version 1.0
+ *
+ * Subject to the condition set forth below, permission is hereby granted to any
+ * person obtaining a copy of this software, associated documentation and/or
+ * data (collectively the "Software"), free of charge and under any and all
+ * copyright rights in the Software, and any and all patent rights owned or
+ * freely licensable by each licensor hereunder covering either (i) the
+ * unmodified Software as contributed to or provided by such licensor, or (ii)
+ * the Larger Works (as defined below), to deal in both
+ *
+ * (a) the Software, and
+ *
+ * (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
+ * one is included with the Software each a "Larger Work" to which the Software
+ * is contributed by such licensors),
+ *
+ * without restriction, including without limitation the rights to copy, create
+ * derivative works of, display, perform, and distribute the Software and make,
+ * use, sell, offer for sale, import, export, have made, and have sold the
+ * Software and the Larger Work(s), and to sublicense the foregoing rights on
+ * either these or other terms.
+ *
+ * This license is subject to the following condition:
+ *
+ * The above copyright notice and either this complete permission notice or at a
+ * minimum a reference to the UPL must be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+package org.graalvm.buildtools.maven;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
+/**
+ * Mojo used to invoke native image building by attaching it to a phase.
+ * Deprecated in favor of compile-no-fork goal.
+ */
+@Deprecated
+@Mojo(name = "build", defaultPhase = LifecyclePhase.PACKAGE,
+ requiresDependencyResolution = ResolutionScope.RUNTIME,
+ requiresDependencyCollection = ResolutionScope.RUNTIME)
+public class DeprecatedNativeBuildMojo extends NativeCompileNoForkMojo {
+
+ @Override
+ public void execute() throws MojoExecutionException {
+ logger.warn("'native:build' goal is deprecated. Use 'native:compile-no-fork' instead.");
+ super.execute();
+ }
+
+}
diff --git a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeCompileNoForkMojo.java b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeCompileNoForkMojo.java
index 20074f534..7993159ac 100644
--- a/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeCompileNoForkMojo.java
+++ b/native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeCompileNoForkMojo.java
@@ -63,7 +63,7 @@
* This goal runs native builds. It functions the same as the native:compile goal, but it
* does not fork the build, so it is suitable for attaching to the build lifecycle.
*/
-@Mojo(name = "build", defaultPhase = LifecyclePhase.PACKAGE,
+@Mojo(name = "compile-no-fork", defaultPhase = LifecyclePhase.PACKAGE,
requiresDependencyResolution = ResolutionScope.RUNTIME,
requiresDependencyCollection = ResolutionScope.RUNTIME)
public class NativeCompileNoForkMojo extends AbstractNativeMojo {
diff --git a/samples/java-application-with-reflection/pom.xml b/samples/java-application-with-reflection/pom.xml
index 7c73bc338..c63d191ef 100644
--- a/samples/java-application-with-reflection/pom.xml
+++ b/samples/java-application-with-reflection/pom.xml
@@ -131,7 +131,7 @@
build-native
- build
+ compile-no-fork
package
diff --git a/samples/java-application-with-resources/pom.xml b/samples/java-application-with-resources/pom.xml
index 93cdbb560..ddcb7b99b 100644
--- a/samples/java-application-with-resources/pom.xml
+++ b/samples/java-application-with-resources/pom.xml
@@ -100,7 +100,7 @@
build-native
generateResourceConfig
- build
+ compile-no-fork
package
diff --git a/samples/java-application-with-tests/pom.xml b/samples/java-application-with-tests/pom.xml
index a29173b56..7f3a1227c 100644
--- a/samples/java-application-with-tests/pom.xml
+++ b/samples/java-application-with-tests/pom.xml
@@ -95,7 +95,7 @@
build-native
- build
+ compile-no-fork
package
@@ -191,7 +191,7 @@
build-native
- build
+ compile-no-fork
package
diff --git a/samples/java-application/pom.xml b/samples/java-application/pom.xml
index ad5140897..960ee2408 100644
--- a/samples/java-application/pom.xml
+++ b/samples/java-application/pom.xml
@@ -79,7 +79,7 @@
build-native
- build
+ compile-no-fork
package
@@ -126,7 +126,7 @@
build-native
- build
+ compile-no-fork
package
diff --git a/samples/java-library/pom.xml b/samples/java-library/pom.xml
index 10554f59f..e23e77264 100644
--- a/samples/java-library/pom.xml
+++ b/samples/java-library/pom.xml
@@ -79,7 +79,7 @@
build-native
- build
+ compile-no-fork
package
diff --git a/samples/metadata-repo-integration/pom.xml b/samples/metadata-repo-integration/pom.xml
index 3cd5d8905..7d42540b5 100644
--- a/samples/metadata-repo-integration/pom.xml
+++ b/samples/metadata-repo-integration/pom.xml
@@ -80,7 +80,7 @@
build-native
- build
+ compile-no-fork
package
@@ -109,7 +109,7 @@
build-native
- build
+ compile-no-fork
package
diff --git a/samples/native-config-integration/pom.xml b/samples/native-config-integration/pom.xml
index 6082d7ab8..258dd5d57 100644
--- a/samples/native-config-integration/pom.xml
+++ b/samples/native-config-integration/pom.xml
@@ -84,7 +84,7 @@
build-native
- build
+ compile-no-fork
package
@@ -128,7 +128,7 @@
build-native
- build
+ compile-no-fork
package