Skip to content

Commit

Permalink
Merge pull request #92 from mojohaus/issue/48
Browse files Browse the repository at this point in the history
Fixes #48 rootlocation does not correctly work
  • Loading branch information
stefanseifert authored Jun 8, 2020
2 parents bfb998d + 933dccf commit e557609
Show file tree
Hide file tree
Showing 29 changed files with 552 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
invoker.goals = validate
invoker.buildResult = success
invoker.project = modules/submodule
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>
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>
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>
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
invoker.goals = validate
invoker.buildResult = success
invoker.project = modules/submodule
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>
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>
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 src/it/rootlocation-in-submodule-nested-separate-parent/pom.xml
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>
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
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 src/it/rootlocation-in-submodule-separate-parent/parent/pom.xml
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 src/it/rootlocation-in-submodule-separate-parent/pom.xml
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 src/it/rootlocation-in-submodule-separate-parent/submodule/pom.xml
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>
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
3 changes: 3 additions & 0 deletions src/it/rootlocation-in-submodule/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
invoker.goals = validate
invoker.buildResult = success
invoker.project = submodule
36 changes: 36 additions & 0 deletions src/it/rootlocation-in-submodule/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<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>

<name>rootlocation search top root</name>
<description>
Tests that rootlocation finds the highest basedir.
</description>

<modules>
<module>submodule</module>
</modules>

<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>
16 changes: 16 additions & 0 deletions src/it/rootlocation-in-submodule/submodule/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<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>
</parent>

<artifactId>project</artifactId>
<packaging>jar</packaging>

<name>rootlocation sub project</name>

</project>
9 changes: 9 additions & 0 deletions src/it/rootlocation-in-submodule/verify.groovy
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"

return true
2 changes: 2 additions & 0 deletions src/it/rootlocation-run-only-at-exec-root/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals = validate
invoker.buildResult = success
39 changes: 39 additions & 0 deletions src/it/rootlocation-run-only-at-exec-root/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<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>

<name>rootlocation run only at execution root</name>
<description>
Tests that rootlocation is executed only at execution top level.
</description>

<modules>
<module>submodule</module>
</modules>

<build>
<plugins>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<goals>
<goal>rootlocation</goal>
</goals>
<configuration>
<runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Loading

0 comments on commit e557609

Please # to comment.