Skip to content

Commit

Permalink
change to groovy to groupId org.apache.groovy and bump version to 4.0…
Browse files Browse the repository at this point in the history
….6 (#154)

Signed-off-by: Olivier Lamy <[email protected]>
  • Loading branch information
olamy authored Dec 9, 2022
1 parent d8a4871 commit 2cde5fd
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 44 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/maven-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ jobs:
build:
name: Verify
uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v3
with:
maven-args: '-D"invoker.streamLogsOnFailures" -U'
# put this back when 3.4.0 with jdk19 support has been released
#jdk-matrix: '[ "8", "11", "17", "19"]'
# verify-fail-fast: false
3 changes: 2 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
* under the License.
*/

asfMavenTlpPlgnBuild()
// put 19 back when 3.4.0 with jdk19 support has been released
asfMavenTlpPlgnBuild(jdks:[ "8", "11", "17"])
54 changes: 36 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ under the License.
</parent>

<artifactId>maven-invoker-plugin</artifactId>
<version>3.3.1-SNAPSHOT</version>
<version>3.4.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>

<name>Apache Maven Invoker Plugin</name>
Expand Down Expand Up @@ -70,9 +70,8 @@ under the License.
<beanshell-groupId>org.apache-extras.beanshell</beanshell-groupId>
<beanshell-artifactId>bsh</beanshell-artifactId>
<beanshell-version>2.0b6</beanshell-version>
<groovy-groupId>org.codehaus.groovy</groovy-groupId>
<groovy-version>3.0.12</groovy-version>
<project.build.outputTimestamp>2022-05-25T15:26:55Z</project.build.outputTimestamp>
<groovy-version>4.0.6</groovy-version>
</properties>

<dependencyManagement>
Expand All @@ -98,6 +97,13 @@ under the License.
<artifactId>commons-io</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-bom</artifactId>
<version>${groovy-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -159,14 +165,7 @@ under the License.
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-script-interpreter</artifactId>
<version>1.3</version>
<exclusions>
<!-- there's already a direct dependency to groovy -->
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
</exclusion>
</exclusions>
<version>1.4-SNAPSHOT</version>
</dependency>

<dependency>
Expand All @@ -189,21 +188,18 @@ under the License.
</dependency>

<dependency>
<groupId>${groovy-groupId}</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${groovy-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>${groovy-groupId}</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-json</artifactId>
<version>${groovy-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>${groovy-groupId}</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-xml</artifactId>
<version>${groovy-version}</version>
<scope>runtime</scope>
</dependency>

Expand Down Expand Up @@ -265,7 +261,6 @@ under the License.
<version>1.7.36</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -332,6 +327,29 @@ under the License.
<version>1.0.0</version>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>ban-org-codehaus-groovy</id>
<goals>
<goal>enforce</goal>
</goals>
<phase>validate</phase>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<exclude>org.codehaus.groovy:*</exclude>
</excludes>
<searchTransitive>true</searchTransitive>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

// ensure script context contains localRepositoryPath
assert new File( basedir, "../../../target/it-repo" ).canonicalFile.equals( localRepositoryPath )

Expand Down
2 changes: 2 additions & 0 deletions src/it/MINVOKER-196_junit_report_file/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
import groovy.xml.XmlSlurper

File buildLog = new File( basedir, 'build.log' )
assert buildLog.text.contains( '[INFO] run post-build script verify.groovy' )

Expand Down
2 changes: 1 addition & 1 deletion src/it/MINVOKER-288-failed-setup-run/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import groovy.xml.XmlSlurper

File invokerReports = new File( new File(basedir, 'target'), 'invoker-reports-test' )
assert invokerReports.exists()
Expand Down
2 changes: 1 addition & 1 deletion src/it/MINVOKER-288-failed-setup-verify/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/

import groovy.xml.XmlSlurper

File invokerReports = new File( new File(basedir, "target"), 'invoker-reports-test' )
assert invokerReports.exists()
Expand Down
2 changes: 2 additions & 0 deletions src/it/local-repo-url/src/it/project/postbuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

// ensure script context contains localRepositoryPath
assert new File( basedir, "../../../target/it-repo" ).canonicalFile.equals( localRepositoryPath )

Expand Down
2 changes: 1 addition & 1 deletion src/it/script-classpath-duplicates/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ under the License.
<scope>test</scope>
</dependency>
<dependency>
<groupId>@groovy-groupId@</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
<version>@groovy-version@</version>
<type>pom</type>
Expand Down
5 changes: 2 additions & 3 deletions src/it/script-streamLogs-false/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ assert beanshellLog.contains('java.lang.OutOfMemoryError: Requested array size e

// groovy failed and no log message
assert !buildLog.contains('[INFO] Output from groovy script')
assert !buildLog.contains('Assertion failed:')
assert !buildLog.contains('assert pom.contains("<modelVersion>9.9.9</modelVersion>")')
assert buildLog.contains('[INFO] org.apache.maven.shared.scriptinterpreter.ScriptEvaluationException: Assertion Error')
assert buildLog.contains('Assertion failed:')
assert buildLog.contains('assert pom.contains("<modelVersion>9.9.9</modelVersion>")')
assert buildLog.contains('[INFO] groovy' + FS + 'pom.xml ................................... FAILED')

assert groovyLog.contains('Output from groovy script')
Expand Down
2 changes: 2 additions & 0 deletions src/it/script-verify-xml/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

// from http://groovy-lang.org/processing-xml.html
// A lot of examples covering xml assertions

Expand Down
8 changes: 4 additions & 4 deletions src/it/selector-scripts/setup.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
* under the License.
*/

import org.apache.commons.io.FileUtils
import java.io.File

// Previous potential target 'content' has impact on IT execution
// (Some new file should be created by verify.sh)
FileUtils.deleteQuietly( new File( basedir, "target/invoker-reports-test" ) );
FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-quiet/target" ) );
FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-true/target" ) );
new File( basedir, "target/invoker-reports-test" ).deleteDir()
new File( basedir, "src/it/script-ret-quiet/target" ).deleteDir()
new File( basedir, "src/it/script-ret-true/target" ).deleteDir()
return true;
2 changes: 2 additions & 0 deletions src/it/settings-merge_jdk9+/src/it/project/postbuild.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
* under the License.
*/

import groovy.xml.XmlSlurper

File effectiveSettings = new File( basedir, "effective-settings.xml" )
assert effectiveSettings.isFile()

Expand Down
21 changes: 6 additions & 15 deletions src/site/apt/groovy-version.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ Groovy version and extensions
<<NOTICE>>: Plugin <<<maven-invoker-plugin>>> in versions older than <<<3.3.0>>> has dependency
on <<<groovy-all>>> artifact from <<<Groovy 2>>>.

Plugin <<<maven-invoker-plugin>>> in version <<<3.3.0>>> has only dependency on <<<Groovy 3>>> core add common extensions:
Plugin <<<maven-invoker-plugin>>> in version <<<3.4.0>>> has only dependency on <<<Groovy 4>>> core add common extensions:

* <<<org.codehaus.groovy:groovy:3.0.10>>>
* <<<org.apache.groovy:groovy:${groovy-version}>>>

* <<<org.codehaus.groovy:groovy-json:3.0.10>>>
* <<<org.apache.groovy:groovy-json:${groovy-version}>>>

* <<<org.codehaus.groovy:groovy-xml:3.0.10>>>
* <<<org.apache.groovy:groovy-xml:${groovy-version}>>>

[]

Expand All @@ -54,7 +54,7 @@ Groovy version and extensions
.....
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-yaml</artifactId>
<version>3.0.10</version>
</dependency>
Expand All @@ -65,14 +65,5 @@ Groovy version and extensions
</project>
+------------------

<<NOTICE>>: In plugin version <<<3.3.0>>> only <<<Groovy 3>>> extensions can be used.
<<NOTICE>>: In plugin version <<<3.3.0>>> only <<<Groovy 4>>> extensions can be used.

Groovy 4

Please be noted that in <<<Groovy 4>>> maven <<<groupId>>> was changed
from <<org.codehaus.groovy>> to <<org.apache.groovy>>.

Plugin has dependency on <<<Groovy 3>>> artifacts with old <<<groupId>>>,
what causes that <<<Groovy 4>>> can not by used in scripts.

Next version of <<<maven-invoker-plugin>>> can contains <<<Groovy 4>>> as default.

0 comments on commit 2cde5fd

Please sign in to comment.