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
  • Loading branch information
aloubyansky committed Jun 14, 2022
1 parent 853d8d7 commit 2020e83
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
Expand Up @@ -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;
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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>
Expand Down

0 comments on commit 2020e83

Please sign in to comment.