-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Issue #48] detect root project location also in special cases:
- maven is executed on a submodule - projects aggregation root and parent is not the same - child modules may reside in deeper nested folders without a pom.xml in between
- Loading branch information
1 parent
d73b14e
commit 933dccf
Showing
21 changed files
with
377 additions
and
20 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
src/it/rootlocation-in-submodule-deeperlevel-separate-parent/invoker.properties
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,3 @@ | ||
invoker.goals = validate | ||
invoker.buildResult = success | ||
invoker.project = modules/submodule |
17 changes: 17 additions & 0 deletions
17
src/it/rootlocation-in-submodule-deeperlevel-separate-parent/modules/submodule/pom.xml
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,17 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-parent</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<relativePath>../../parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>project</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>rootlocation sub project</name> | ||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
src/it/rootlocation-in-submodule-deeperlevel-separate-parent/parent/pom.xml
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,27 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-parent</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>rootlocation</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
src/it/rootlocation-in-submodule-deeperlevel-separate-parent/pom.xml
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,27 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-parent</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<relativePath>parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-root</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<name>rootlocation search top root</name> | ||
<description> | ||
Tests that rootlocation finds the highest basedir. | ||
</description> | ||
|
||
<modules> | ||
<module>parent</module> | ||
<module>modules/submodule</module> | ||
</modules> | ||
|
||
</project> |
9 changes: 9 additions & 0 deletions
9
src/it/rootlocation-in-submodule-deeperlevel-separate-parent/verify.groovy
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,9 @@ | ||
File file = new File( basedir, "build.log" ) | ||
assert file.exists() | ||
|
||
String text = file.getText("utf-8") | ||
|
||
def rootFolderName = (text =~ /(?ms)(.*?)define property rootlocation = "(.*?)[\/\\]([^\/\\"]+)"(.*?)/)[0][3] | ||
assert rootFolderName == "rootlocation-in-submodule-deeperlevel-separate-parent" | ||
|
||
return true |
3 changes: 3 additions & 0 deletions
3
src/it/rootlocation-in-submodule-nested-separate-parent/invoker.properties
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,3 @@ | ||
invoker.goals = validate | ||
invoker.buildResult = success | ||
invoker.project = modules/submodule |
19 changes: 19 additions & 0 deletions
19
src/it/rootlocation-in-submodule-nested-separate-parent/modules/pom.xml
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,19 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-parent</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<relativePath>../parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>build-helper-rootlocation-modules</artifactId> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>submodule</module> | ||
</modules> | ||
|
||
</project> |
17 changes: 17 additions & 0 deletions
17
src/it/rootlocation-in-submodule-nested-separate-parent/modules/submodule/pom.xml
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,17 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-parent</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<relativePath>../../parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>project</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>rootlocation sub project</name> | ||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
src/it/rootlocation-in-submodule-nested-separate-parent/parent/pom.xml
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,27 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-parent</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>rootlocation</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
src/it/rootlocation-in-submodule-nested-separate-parent/pom.xml
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,27 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-parent</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<relativePath>parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-root</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<name>rootlocation search top root</name> | ||
<description> | ||
Tests that rootlocation finds the highest basedir. | ||
</description> | ||
|
||
<modules> | ||
<module>parent</module> | ||
<module>modules</module> | ||
</modules> | ||
|
||
</project> |
9 changes: 9 additions & 0 deletions
9
src/it/rootlocation-in-submodule-nested-separate-parent/verify.groovy
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,9 @@ | ||
File file = new File( basedir, "build.log" ) | ||
assert file.exists() | ||
|
||
String text = file.getText("utf-8") | ||
|
||
def rootFolderName = (text =~ /(?ms)(.*?)define property rootlocation = "(.*?)[\/\\]([^\/\\"]+)"(.*?)/)[0][3] | ||
assert rootFolderName == "rootlocation-in-submodule-nested-separate-parent" | ||
|
||
return true |
3 changes: 3 additions & 0 deletions
3
src/it/rootlocation-in-submodule-separate-parent/invoker.properties
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,3 @@ | ||
invoker.goals = validate | ||
invoker.buildResult = success | ||
invoker.project = submodule |
27 changes: 27 additions & 0 deletions
27
src/it/rootlocation-in-submodule-separate-parent/parent/pom.xml
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,27 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-parent</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>@project.groupId@</groupId> | ||
<artifactId>@project.artifactId@</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>rootlocation</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
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,27 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-parent</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<relativePath>parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-root</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
|
||
<name>rootlocation search top root</name> | ||
<description> | ||
Tests that rootlocation finds the highest basedir. | ||
</description> | ||
|
||
<modules> | ||
<module>parent</module> | ||
<module>submodule</module> | ||
</modules> | ||
|
||
</project> |
17 changes: 17 additions & 0 deletions
17
src/it/rootlocation-in-submodule-separate-parent/submodule/pom.xml
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,17 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>build-helper-rootlocation-parent</artifactId> | ||
<version>1-SNAPSHOT</version> | ||
<relativePath>../parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>project</artifactId> | ||
<packaging>jar</packaging> | ||
|
||
<name>rootlocation sub project</name> | ||
|
||
</project> |
9 changes: 9 additions & 0 deletions
9
src/it/rootlocation-in-submodule-separate-parent/verify.groovy
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,9 @@ | ||
File file = new File( basedir, "build.log" ) | ||
assert file.exists() | ||
|
||
String text = file.getText("utf-8") | ||
|
||
def rootFolderName = (text =~ /(?ms)(.*?)define property rootlocation = "(.*?)[\/\\]([^\/\\"]+)"(.*?)/)[0][3] | ||
assert rootFolderName == "rootlocation-in-submodule-separate-parent" | ||
|
||
return true |
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
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
Oops, something went wrong.