Loading .gitignore +3 −0 Original line number Diff line number Diff line Loading @@ -7,3 +7,6 @@ pom.xml.versionsBackup .project .classpath # Visual Studio Code .factorypath src/main/java/com/inteligr8/alfresco/amp/AmpDependencyFilter.java +18 −2 Original line number Diff line number Diff line Loading @@ -29,12 +29,23 @@ public class AmpDependencyFilter implements DependencyFilter { private final Log log; private final Charset charset; private final ArtifactResolutionCallback callback; private final String projectModuleId; private Set<String> moduleIds = new HashSet<String>(); public AmpDependencyFilter(Log log, String charsetName, ArtifactResolutionCallback callback) { this.log = log; this.charset = Charset.forName(charsetName); this.callback = callback; this.projectModuleId = this.getModuleId(this.callback.getProject().getArtifact()); } private String getModuleId(org.apache.maven.artifact.Artifact artifact) { return artifact.getGroupId() + "." + artifact.getArtifactId(); } private String getModuleId(Artifact artifact) { return artifact.getGroupId() + "." + artifact.getArtifactId(); } @Override Loading @@ -43,14 +54,19 @@ public class AmpDependencyFilter implements DependencyFilter { if (this.log.isDebugEnabled()) this.log.debug("Checking dependency: " + artifact.getArtifactId()); String moduleId = artifact.getGroupId() + "." + artifact.getArtifactId(); String moduleId = this.getModuleId(artifact); if (this.projectModuleId.equals(moduleId)) { // always include project itself, even if it is a module return true; } if (this.moduleIds.contains(moduleId)) { if (this.log.isDebugEnabled()) this.log.debug("Not packaging library; detected as Alfresco Module: " + node.getArtifact().getArtifactId()); return false; } else if (parents != null) { for (DependencyNode parent : parents) { String parentModuleId = parent.getArtifact().getGroupId() + "." + parent.getArtifact().getArtifactId(); String parentModuleId = this.getModuleId(parent.getArtifact()); if (this.moduleIds.contains(parentModuleId)) { this.moduleIds.add(moduleId); if (this.log.isDebugEnabled()) Loading src/main/java/com/inteligr8/alfresco/amp/AmpMojo.java +5 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,11 @@ public class AmpMojo extends AbstractMojo implements ArtifactResolutionCallback @Parameter( property = "skip", required = true, defaultValue = "false" ) protected boolean skip; @Override public MavenProject getProject() { return this.project; } public void execute() throws MojoExecutionException { if (this.skip) { this.getLog().debug("Skipped AMP package"); Loading src/main/java/com/inteligr8/alfresco/amp/ArtifactResolutionCallback.java +3 −0 Original line number Diff line number Diff line package com.inteligr8.alfresco.amp; import org.apache.maven.project.MavenProject; import org.eclipse.aether.resolution.ArtifactRequest; import org.eclipse.aether.resolution.ArtifactResolutionException; import org.eclipse.aether.resolution.ArtifactResult; public interface ArtifactResolutionCallback { MavenProject getProject(); ArtifactResult resolveArtifact(ArtifactRequest artifactRequest) throws ArtifactResolutionException; } Loading
.gitignore +3 −0 Original line number Diff line number Diff line Loading @@ -7,3 +7,6 @@ pom.xml.versionsBackup .project .classpath # Visual Studio Code .factorypath
src/main/java/com/inteligr8/alfresco/amp/AmpDependencyFilter.java +18 −2 Original line number Diff line number Diff line Loading @@ -29,12 +29,23 @@ public class AmpDependencyFilter implements DependencyFilter { private final Log log; private final Charset charset; private final ArtifactResolutionCallback callback; private final String projectModuleId; private Set<String> moduleIds = new HashSet<String>(); public AmpDependencyFilter(Log log, String charsetName, ArtifactResolutionCallback callback) { this.log = log; this.charset = Charset.forName(charsetName); this.callback = callback; this.projectModuleId = this.getModuleId(this.callback.getProject().getArtifact()); } private String getModuleId(org.apache.maven.artifact.Artifact artifact) { return artifact.getGroupId() + "." + artifact.getArtifactId(); } private String getModuleId(Artifact artifact) { return artifact.getGroupId() + "." + artifact.getArtifactId(); } @Override Loading @@ -43,14 +54,19 @@ public class AmpDependencyFilter implements DependencyFilter { if (this.log.isDebugEnabled()) this.log.debug("Checking dependency: " + artifact.getArtifactId()); String moduleId = artifact.getGroupId() + "." + artifact.getArtifactId(); String moduleId = this.getModuleId(artifact); if (this.projectModuleId.equals(moduleId)) { // always include project itself, even if it is a module return true; } if (this.moduleIds.contains(moduleId)) { if (this.log.isDebugEnabled()) this.log.debug("Not packaging library; detected as Alfresco Module: " + node.getArtifact().getArtifactId()); return false; } else if (parents != null) { for (DependencyNode parent : parents) { String parentModuleId = parent.getArtifact().getGroupId() + "." + parent.getArtifact().getArtifactId(); String parentModuleId = this.getModuleId(parent.getArtifact()); if (this.moduleIds.contains(parentModuleId)) { this.moduleIds.add(moduleId); if (this.log.isDebugEnabled()) Loading
src/main/java/com/inteligr8/alfresco/amp/AmpMojo.java +5 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,11 @@ public class AmpMojo extends AbstractMojo implements ArtifactResolutionCallback @Parameter( property = "skip", required = true, defaultValue = "false" ) protected boolean skip; @Override public MavenProject getProject() { return this.project; } public void execute() throws MojoExecutionException { if (this.skip) { this.getLog().debug("Skipped AMP package"); Loading
src/main/java/com/inteligr8/alfresco/amp/ArtifactResolutionCallback.java +3 −0 Original line number Diff line number Diff line package com.inteligr8.alfresco.amp; import org.apache.maven.project.MavenProject; import org.eclipse.aether.resolution.ArtifactRequest; import org.eclipse.aether.resolution.ArtifactResolutionException; import org.eclipse.aether.resolution.ArtifactResult; public interface ArtifactResolutionCallback { MavenProject getProject(); ArtifactResult resolveArtifact(ArtifactRequest artifactRequest) throws ArtifactResolutionException; }