Skip to content

Commit 77941e4

Browse files
alvarosanchezmelix
authored andcommitted
Support applications with custom packaging types
If an application has a custom packaging type, but its artefact is really a JAR file, I will be skipped by the classpath calculation algorithm. This PR allows the main project artifact to have a different packaging type, which is the case of Micronaut applications packaged as native images (`<packaging>native-image</packaging>`).
1 parent d17200a commit 77941e4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

native-maven-plugin/src/main/java/org/graalvm/buildtools/maven/NativeBuildMojo.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public void execute() throws MojoExecutionException {
123123
for (Artifact dependency : project.getArtifacts()) {
124124
addClasspath(dependency);
125125
}
126-
addClasspath(project.getArtifact());
126+
addClasspath(project.getArtifact(), project.getPackaging());
127127
}
128128
String classpathStr = imageClasspath.stream().map(Path::toString).collect(Collectors.joining(File.pathSeparator));
129129

@@ -156,7 +156,11 @@ public void execute() throws MojoExecutionException {
156156
}
157157

158158
private void addClasspath(Artifact artifact) throws MojoExecutionException {
159-
if (!"jar".equals(artifact.getType())) {
159+
addClasspath(artifact, "jar");
160+
}
161+
162+
private void addClasspath(Artifact artifact, String artifactType) throws MojoExecutionException {
163+
if (!artifactType.equals(artifact.getType())) {
160164
getLog().warn("Ignoring non-jar type ImageClasspath Entry " + artifact);
161165
return;
162166
}

0 commit comments

Comments
 (0)