Skip to content

Commit

Permalink
Adjusted config for removed resources in the ExtensionDescriptorMojo …
Browse files Browse the repository at this point in the history
…to have valid XML

(cherry picked from commit 26f9c40)
aloubyansky authored and gsmet committed Jun 15, 2022

Verified

This commit was signed with the committer’s verified signature.
gsmet Guillaume Smet
1 parent c9ff333 commit 146245f
Showing 3 changed files with 27 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace;
import io.quarkus.bootstrap.util.DependencyNodeUtils;
import io.quarkus.fs.util.ZipUtils;
import io.quarkus.maven.ExtensionDescriptorMojo.RemovedResources;
import io.quarkus.maven.capabilities.CapabilitiesConfig;
import io.quarkus.maven.capabilities.CapabilityConfig;
import io.quarkus.maven.dependency.ArtifactCoords;
@@ -91,6 +92,11 @@
@Mojo(name = "extension-descriptor", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class ExtensionDescriptorMojo extends AbstractMojo {

public static class RemovedResources {
String key;
String resources;
}

private static final String GROUP_ID = "group-id";
private static final String ARTIFACT_ID = "artifact-id";
private static final String METADATA = "metadata";
@@ -164,7 +170,7 @@ public class ExtensionDescriptorMojo extends AbstractMojo {
* but in the `META-INF/quarkus-extension.properties`.
*/
@Parameter
Map<String, String> removedResources = Map.of();
List<RemovedResources> removedResources = List.of();

/**
* Artifacts that are always loaded parent first when running in dev or test mode. This is an advanced option
@@ -321,18 +327,18 @@ public void execute() throws MojoExecutionException {
}

if (!removedResources.isEmpty()) {
for (Map.Entry<String, String> entry : removedResources.entrySet()) {
for (RemovedResources entry : removedResources) {
final ArtifactKey key;
try {
key = ArtifactKey.fromString(entry.getKey());
key = ArtifactKey.fromString(entry.key);
} catch (IllegalArgumentException e) {
throw new MojoExecutionException(
"Failed to parse removed resource '" + entry.getKey() + '=' + entry.getValue() + "'", e);
"Failed to parse removed resource '" + entry.key + '=' + entry.resources + "'", e);
}
if (entry.getValue() == null || entry.getValue().isBlank()) {
if (entry.resources == null || entry.resources.isBlank()) {
continue;
}
final String[] resources = entry.getValue().split(",");
final String[] resources = entry.resources.split(",");
if (resources.length == 0) {
continue;
}
Original file line number Diff line number Diff line change
@@ -87,6 +87,11 @@
@Mojo(name = "extension-descriptor", defaultPhase = LifecyclePhase.PROCESS_RESOURCES, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, threadSafe = true)
public class ExtensionDescriptorMojo extends AbstractMojo {

public static class RemovedResources {
String key;
String resources;
}

private static final String GROUP_ID = "group-id";
private static final String ARTIFACT_ID = "artifact-id";
private static final String METADATA = "metadata";
@@ -169,7 +174,7 @@ public class ExtensionDescriptorMojo extends AbstractMojo {
* but in the `META-INF/quarkus-extension.properties`.
*/
@Parameter
Map<String, String> removedResources = Map.of();
List<RemovedResources> removedResources = List.of();

/**
* Artifacts that are always loaded parent first when running in dev or test mode. This is an advanced option
@@ -336,18 +341,18 @@ public void execute() throws MojoExecutionException {
}

if (!removedResources.isEmpty()) {
for (Map.Entry<String, String> entry : removedResources.entrySet()) {
for (RemovedResources entry : removedResources) {
final ArtifactKey key;
try {
key = ArtifactKey.fromString(entry.getKey());
key = ArtifactKey.fromString(entry.key);
} catch (IllegalArgumentException e) {
throw new MojoExecutionException(
"Failed to parse removed resource '" + entry.getKey() + '=' + entry.getValue() + "'", e);
"Failed to parse removed resource '" + entry.key + '=' + entry.resources + "'", e);
}
if (entry.getValue() == null || entry.getValue().isBlank()) {
if (entry.resources == null || entry.resources.isBlank()) {
continue;
}
final String[] resources = entry.getValue().split(",");
final String[] resources = entry.resources.split(",");
if (resources.length == 0) {
continue;
}
Original file line number Diff line number Diff line change
@@ -34,7 +34,10 @@
<configuration>
<deployment>\${project.groupId}:\${project.artifactId}-deployment:\${project.version}</deployment>
<removedResources>
<org.acme:acme-resources>META-INF/a</org.acme:acme-resources>
<artifact>
<key>org.acme:acme-resources</key>
<resources>META-INF/a</resources>
</artifact>
</removedResources>
</configuration>
</execution>

0 comments on commit 146245f

Please sign in to comment.