proper meta-inf/services support

This commit is contained in:
Brian Long 2024-03-11 22:45:38 -04:00
parent c4385d11b4
commit a75429ea40
3 changed files with 16 additions and 13 deletions

View File

@ -32,7 +32,6 @@ import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult;
import org.eclipse.aether.transfer.ArtifactNotFoundException;
import com.inteligr8.wildfly.maven.model.WildflyArtifact;
import com.inteligr8.wildfly.maven.model.WildflyDeployable;
@ -70,8 +69,8 @@ public class WildflyArtifactExtractor {
WildflyModule module = new WildflyModule();
module.id = artifact.getProperty("id", null);
module.version = artifact.getProperty("version", null);
module.exportMetaInf = Boolean.parseBoolean(artifact.getProperty("exportMetaInf", Boolean.FALSE.toString()));
module.exportServices = Boolean.parseBoolean(artifact.getProperty("exportServices", Boolean.FALSE.toString()));
module.exportMetaInf = artifact.getProperty("exportMetaInf", null);
module.exportServices = artifact.getProperty("exportServices", null);
module.exportAnnotations = Boolean.parseBoolean(artifact.getProperty("exportAnnotations", Boolean.FALSE.toString()));
module.isSystem = Boolean.parseBoolean(artifact.getProperty("isSystem", Boolean.FALSE.toString()));
return module;
@ -144,16 +143,20 @@ public class WildflyArtifactExtractor {
WildflyModule module = new WildflyModule();
module.id = moduleId;
module.version = moduleVersion;
module.exportMetaInf = Boolean.parseBoolean(modelProps.getProperty("wildfly.module.meta"));
module.exportServices = Boolean.parseBoolean(modelProps.getProperty("wildfly.module.services"));
module.exportMetaInf = modelProps.getProperty("wildfly.module.meta");
module.exportServices = modelProps.getProperty("wildfly.module.services");
module.exportAnnotations = Boolean.parseBoolean(modelProps.getProperty("wildfly.module.annotations"));
module.isSystem = Boolean.parseBoolean(modelProps.getProperty("wildfly.module.system"));
// for backward compatibility
if ("true".equalsIgnoreCase(module.exportMetaInf))
module.exportMetaInf = "export";
Map<String, String> props = new HashMap<>();
props.put("id", module.id);
props.put("version", module.version);
props.put("exportMetaInf", String.valueOf(module.exportMetaInf));
props.put("exportServices", String.valueOf(module.exportServices));
props.put("exportServices", module.exportServices);
props.put("exportAnnotations", String.valueOf(module.exportAnnotations));
props.put("isSystem", String.valueOf(module.isSystem));
artifact.setProperties(props);

View File

@ -17,8 +17,8 @@ package com.inteligr8.wildfly.maven.model;
public class WildflyModule extends WildflyArtifact {
public boolean export;
public boolean exportMetaInf;
public boolean exportServices;
public String exportMetaInf;
public String exportServices;
public boolean exportAnnotations;
public boolean exportOptional;
public boolean isSystem;

View File

@ -66,12 +66,12 @@ public abstract class AbstractXmlBuilder {
moduleElement.setAttribute("slot", module.version);
if (module.export)
moduleElement.setAttribute("export", Boolean.TRUE.toString());
if (isDeployment && module.exportMetaInf)
moduleElement.setAttribute("meta-inf", "export");
if (module.exportServices)
moduleElement.setAttribute("services", "export");
if (isDeployment && module.exportMetaInf != null)
moduleElement.setAttribute("meta-inf", module.exportMetaInf);
if (module.exportServices != null)
moduleElement.setAttribute("services", module.exportServices);
if (isDeployment && module.exportAnnotations)
moduleElement.setAttribute("annotations", "export");
moduleElement.setAttribute("annotations", Boolean.TRUE.toString());
this.dependenciesElement.appendChild(moduleElement);
}