Merge branch 'develop' into stable

This commit is contained in:
Brian Long 2024-03-11 22:46:29 -04:00
commit 3aba1362dd
4 changed files with 43 additions and 32 deletions

View File

@ -32,7 +32,6 @@ import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.resolution.ArtifactRequest; import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResolutionException; import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult; 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.WildflyArtifact;
import com.inteligr8.wildfly.maven.model.WildflyDeployable; import com.inteligr8.wildfly.maven.model.WildflyDeployable;
@ -70,8 +69,8 @@ public class WildflyArtifactExtractor {
WildflyModule module = new WildflyModule(); WildflyModule module = new WildflyModule();
module.id = artifact.getProperty("id", null); module.id = artifact.getProperty("id", null);
module.version = artifact.getProperty("version", null); module.version = artifact.getProperty("version", null);
module.exportMetaInf = Boolean.parseBoolean(artifact.getProperty("exportMetaInf", Boolean.FALSE.toString())); module.exportMetaInf = artifact.getProperty("exportMetaInf", null);
module.exportServices = Boolean.parseBoolean(artifact.getProperty("exportServices", Boolean.FALSE.toString())); module.exportServices = artifact.getProperty("exportServices", null);
module.exportAnnotations = Boolean.parseBoolean(artifact.getProperty("exportAnnotations", Boolean.FALSE.toString())); module.exportAnnotations = Boolean.parseBoolean(artifact.getProperty("exportAnnotations", Boolean.FALSE.toString()));
module.isSystem = Boolean.parseBoolean(artifact.getProperty("isSystem", Boolean.FALSE.toString())); module.isSystem = Boolean.parseBoolean(artifact.getProperty("isSystem", Boolean.FALSE.toString()));
return module; return module;
@ -108,25 +107,27 @@ public class WildflyArtifactExtractor {
if (this.getLog().isDebugEnabled()) if (this.getLog().isDebugEnabled())
this.getLog().debug("Formulated artifact effective POM [" + artifact + "]: " + model.getId()); this.getLog().debug("Formulated artifact effective POM [" + artifact + "]: " + model.getId());
switch (model.getPackaging().toLowerCase()) { if (!"client".equals(artifact.getClassifier())) {
case "ear": switch (model.getPackaging().toLowerCase()) {
case "war": case "ear":
case "ejb": case "war":
this.getLog().debug("Discovered deployable artifact [" + artifact + "]: " + model.getId()); case "ejb":
this.getLog().debug("Discovered deployable artifact [" + artifact + "]: " + model.getId());
WildflyDeployable deployable = new WildflyDeployable();
deployable.id = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getClassifier(); WildflyDeployable deployable = new WildflyDeployable();
deployable.version = artifact.getVersion(); deployable.id = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getClassifier();
deployable.type = model.getPackaging(); deployable.version = artifact.getVersion();
deployable.type = model.getPackaging();
Map<String, String> props = new HashMap<>();
props.put("id", deployable.id); Map<String, String> props = new HashMap<>();
props.put("version", deployable.version); props.put("id", deployable.id);
props.put("type", deployable.type); props.put("version", deployable.version);
artifact.setProperties(props); props.put("type", deployable.type);
artifact.setProperties(props);
return deployable;
default: return deployable;
default:
}
} }
Properties modelProps = model.getProperties(); Properties modelProps = model.getProperties();
@ -142,16 +143,20 @@ public class WildflyArtifactExtractor {
WildflyModule module = new WildflyModule(); WildflyModule module = new WildflyModule();
module.id = moduleId; module.id = moduleId;
module.version = moduleVersion; module.version = moduleVersion;
module.exportMetaInf = Boolean.parseBoolean(modelProps.getProperty("wildfly.module.meta")); module.exportMetaInf = modelProps.getProperty("wildfly.module.meta");
module.exportServices = Boolean.parseBoolean(modelProps.getProperty("wildfly.module.services")); module.exportServices = modelProps.getProperty("wildfly.module.services");
module.exportAnnotations = Boolean.parseBoolean(modelProps.getProperty("wildfly.module.annotations")); module.exportAnnotations = Boolean.parseBoolean(modelProps.getProperty("wildfly.module.annotations"));
module.isSystem = Boolean.parseBoolean(modelProps.getProperty("wildfly.module.system")); 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<>(); Map<String, String> props = new HashMap<>();
props.put("id", module.id); props.put("id", module.id);
props.put("version", module.version); props.put("version", module.version);
props.put("exportMetaInf", String.valueOf(module.exportMetaInf)); 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("exportAnnotations", String.valueOf(module.exportAnnotations));
props.put("isSystem", String.valueOf(module.isSystem)); props.put("isSystem", String.valueOf(module.isSystem));
artifact.setProperties(props); artifact.setProperties(props);

View File

@ -16,6 +16,8 @@ package com.inteligr8.wildfly.maven.goal;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.LifecyclePhase;
@ -39,6 +41,8 @@ public class CopyDeploymentResourcesGoal extends AbstractDeploymentGoal {
private File libDirectory; private File libDirectory;
private List<String> manifestClassPath = new LinkedList<>();
@Override @Override
protected void executePre() throws MojoExecutionException { protected void executePre() throws MojoExecutionException {
if (this.isWebApp()) { if (this.isWebApp()) {
@ -53,6 +57,7 @@ public class CopyDeploymentResourcesGoal extends AbstractDeploymentGoal {
protected void handleDependency(Dependency dependency) throws MojoExecutionException { protected void handleDependency(Dependency dependency) throws MojoExecutionException {
try { try {
FileUtils.copyFileToDirectory(dependency.getArtifact().getFile(), this.libDirectory); FileUtils.copyFileToDirectory(dependency.getArtifact().getFile(), this.libDirectory);
this.manifestClassPath.add(this.libPath + "/" + dependency.getArtifact().getFile().getName());
} catch (IOException ie) { } catch (IOException ie) {
throw new MojoExecutionException("An I/O related issue occurred", ie); throw new MojoExecutionException("An I/O related issue occurred", ie);
} }
@ -67,6 +72,7 @@ public class CopyDeploymentResourcesGoal extends AbstractDeploymentGoal {
@Override @Override
public void executePost() throws MojoExecutionException { public void executePost() throws MojoExecutionException {
} }
} }

View File

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

View File

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