forked from rhuss/docker-maven-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update maven libraries and remove guava restriction
Remove the pinning of Guava to version 14.0.1 to fix spotify/docker-maven-plugin#165. Guava was held to 14.0.1 before because a combination of Plexus/Guice code used or invoked by the maven plugin testing harness called methods in Guava that have been removed after version (specifically `MapMaker.makeComputingMap). The main fix to remove that need is to avoid using that part of the testing harness altogether by stubbing out the `MavenProject` instance instead of trying to look it up in the Plexus container. Fixes fabric8io#165.
- Loading branch information
Showing
3 changed files
with
63 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.spotify.docker; | ||
|
||
import org.apache.maven.model.Build; | ||
import org.apache.maven.model.Model; | ||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader; | ||
import org.apache.maven.plugin.testing.stubs.MavenProjectStub; | ||
import org.codehaus.plexus.util.ReaderFactory; | ||
|
||
import java.io.File; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Custom stub implementation of {@link org.apache.maven.project.MavenProject}. | ||
* <p> | ||
* Originally taken from <a href="https://maven.apache.org/plugin-testing/maven-plugin-testing-harness/examples/complex-mojo-parameters.html"> | ||
* Maven Plugin Testing Mechanism</a> guide but adapted for our use case.</p> | ||
*/ | ||
public class ProjectStub extends MavenProjectStub { | ||
|
||
public ProjectStub(File pom) { | ||
MavenXpp3Reader pomReader = new MavenXpp3Reader(); | ||
Model model; | ||
try { | ||
model = pomReader.read(ReaderFactory.newXmlReader(pom)); | ||
setModel(model); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
|
||
setGroupId(model.getGroupId()); | ||
setArtifactId(model.getArtifactId()); | ||
setVersion(model.getVersion()); | ||
setName(model.getName()); | ||
setUrl(model.getUrl()); | ||
setPackaging(model.getPackaging()); | ||
setBuild(model.getBuild()); | ||
|
||
List<String> compileSourceRoots = new ArrayList<>(); | ||
compileSourceRoots.add(getBasedir() + "/src/main/java"); | ||
setCompileSourceRoots(compileSourceRoots); | ||
|
||
List<String> testCompileSourceRoots = new ArrayList<>(); | ||
testCompileSourceRoots.add(getBasedir() + "/src/test/java"); | ||
setTestCompileSourceRoots(testCompileSourceRoots); | ||
|
||
// normalize some expressions | ||
getBuild().setDirectory("${project.basedir}/target"); | ||
getBuild().setTestOutputDirectory(new File(getBasedir(), "target/classes").getAbsolutePath()); | ||
} | ||
} |