Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

AMPS-679: Fix basedir for Maven 3 run-standalone.

Set a dummy project file in standalone runs for Maven 3, as for
Maven 2. Necessary now buildRootProperty uses that value.


git-svn-id: https://studio.atlassian.com/svn/AMPS/branches/3.7-stable@133917 2c54a935-e501-0410-bc05-97a93f6bca70
  • Loading branch information...
commit a798d760b4f58b84cc9df001a1423a8dc92792ec 1 parent 9bad4b0
@josephw josephw authored
View
8 maven-amps-plugin/src/main/java/com/atlassian/maven/plugins/amps/RunStandaloneMojo.java
@@ -13,6 +13,7 @@
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.locator.DefaultModelLocator;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
@@ -174,13 +175,15 @@ protected MavenGoals createMavenGoals(ProjectBuilder projectBuilder)
MavenSession oldSession = oldContext.getSession();
+ File base = new File("amps-standalone").getAbsoluteFile();
+
ProjectBuildingRequest pbr = oldSession.getProjectBuildingRequest();
// hack #1 from before
pbr.setRemoteRepositories(oldSession.getCurrentProject().getRemoteArtifactRepositories());
pbr.setPluginArtifactRepositories(oldSession.getCurrentProject().getPluginArtifactRepositories());
- pbr.getSystemProperties().setProperty("project.basedir", "amps-standalone");
+ pbr.getSystemProperties().setProperty("project.basedir", base.getPath());
ProjectBuildingResult result = projectBuilder.build(getStandaloneArtifact(), false, pbr);
@@ -189,6 +192,9 @@ protected MavenGoals createMavenGoals(ProjectBuilder projectBuilder)
MavenSession newSession = oldSession.clone();
newSession.setProjects(newReactor);
+ // Horrible hack #3 from before
+ result.getProject().setFile(new DefaultModelLocator().locatePom(base));
+
final MavenContext newContext = oldContext.with(
result.getProject(),
newReactor,
Please sign in to comment.
Something went wrong with that request. Please try again.