Maven: set packaging of archetype artifact to 'maven-archetype'

This commit is contained in:
Alexey Andreev 2023-03-06 11:58:50 +01:00
parent ddab106c5a
commit 0e4b0f6b11
3 changed files with 19 additions and 0 deletions

View File

@ -19,4 +19,8 @@ public interface PublishTeaVMExtension {
String getArtifactId(); String getArtifactId();
void setArtifactId(String artifactId); void setArtifactId(String artifactId);
String getPackaging();
void setPackaging(String packaging);
} }

View File

@ -75,10 +75,14 @@ public abstract class PublishTeaVMPlugin implements Plugin<Project> {
publication.setArtifactId(extension.getArtifactId()); publication.setArtifactId(extension.getArtifactId());
} }
publication.from(project.getComponents().getByName("java")); publication.from(project.getComponents().getByName("java"));
if (extension.packaging != null) {
publication.getPom().setPackaging(extension.packaging);
}
} }
private static class ExtensionImpl implements PublishTeaVMExtension { private static class ExtensionImpl implements PublishTeaVMExtension {
private String artifactId; private String artifactId;
private String packaging;
@Override @Override
public String getArtifactId() { public String getArtifactId() {
@ -89,5 +93,15 @@ public abstract class PublishTeaVMPlugin implements Plugin<Project> {
public void setArtifactId(String artifactId) { public void setArtifactId(String artifactId) {
this.artifactId = artifactId; this.artifactId = artifactId;
} }
@Override
public String getPackaging() {
return packaging;
}
@Override
public void setPackaging(String packaging) {
this.packaging = packaging;
}
} }
} }

View File

@ -30,4 +30,5 @@ tasks.processResources {
teavmPublish { teavmPublish {
artifactId = "teavm-maven-webapp" artifactId = "teavm-maven-webapp"
packaging = "maven-archetype"
} }