diff --git a/polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaModelProcessor.java b/polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaModelProcessor.java index e613c14a..a7a96bda 100644 --- a/polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaModelProcessor.java +++ b/polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaModelProcessor.java @@ -32,6 +32,7 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Writer; import org.codehaus.plexus.util.FileUtils; import org.codehaus.plexus.util.IOUtil; +import org.eclipse.sisu.Priority; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.codehaus.plexus.util.ReaderFactory; @@ -46,6 +47,7 @@ //@Component(role = ModelProcessor.class, hint = "tesla-polyglot") @Singleton @Named +@Priority(10) public class TeslaModelProcessor implements ModelProcessor { private static final String DEFAULT_POM_FILE = "pom.xml"; diff --git a/polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaProjectBuilder.java b/polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaProjectBuilder.java index 025ee887..d2202075 100644 --- a/polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaProjectBuilder.java +++ b/polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaProjectBuilder.java @@ -12,37 +12,48 @@ import org.apache.maven.model.building.ModelProblem; import org.apache.maven.model.building.ModelSource; import org.apache.maven.project.*; +import org.eclipse.sisu.Priority; + +import static java.util.Objects.requireNonNull; @Singleton @Named -public class TeslaProjectBuilder extends DefaultProjectBuilder { +@Priority(10) +public class TeslaProjectBuilder implements ProjectBuilder { + + private final TeslaModelProcessor teslaModelProcessor; + + private final DefaultProjectBuilder defaultProjectBuilder; @Inject - private TeslaModelProcessor teslaModelProcessor; // Must be named differently than the one in the superclass + public TeslaProjectBuilder(TeslaModelProcessor teslaModelProcessor, DefaultProjectBuilder defaultProjectBuilder) { + this.teslaModelProcessor = requireNonNull(teslaModelProcessor); + this.defaultProjectBuilder = requireNonNull(defaultProjectBuilder); + } @Override public ProjectBuildingResult build(File pomFile, ProjectBuildingRequest request) throws ProjectBuildingException { - return convert(super.build(pomFile, request)); + return convert(defaultProjectBuilder.build(pomFile, request)); } @Override public ProjectBuildingResult build(ModelSource modelSource, ProjectBuildingRequest request) throws ProjectBuildingException { - return convert(super.build(modelSource, request)); + return convert(defaultProjectBuilder.build(modelSource, request)); } @Override public ProjectBuildingResult build(Artifact artifact, ProjectBuildingRequest request) throws ProjectBuildingException { - return convert(super.build(artifact, request)); + return convert(defaultProjectBuilder.build(artifact, request)); } @Override public ProjectBuildingResult build(Artifact artifact, boolean allowStubModel, ProjectBuildingRequest request) throws ProjectBuildingException { - return convert(super.build(artifact, allowStubModel, request)); + return convert(defaultProjectBuilder.build(artifact, allowStubModel, request)); } @Override public List build(List pomFiles, boolean recursive, ProjectBuildingRequest request) throws ProjectBuildingException { - List results = super.build(pomFiles, recursive, request); + List results = defaultProjectBuilder.build(pomFiles, recursive, request); return results.stream().map(this::convert).collect(Collectors.toList()); }