groovy / GMavenPlus

A rewrite of GMaven, a Maven plugin for Groovy
Other
285 stars 35 forks source link

gmavenplus using wrong version to compile #215

Closed jndietz closed 1 year ago

jndietz commented 2 years ago

I have a pom.xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.fnni.api</groupId>
    <version>1.0-SNAPSHOT</version>
    <artifactId>exp-card</artifactId>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.4</version>
    </parent>

    <properties>
        <groovy.version>3.0.10</groovy.version>
        <spock.version>2.1-groovy-3.0</spock.version>
        <jacoco.version>0.8.7</jacoco.version>
        <sonar.coverage.exclusions>
            **/*/*Spec.groovy,
            **/*/pom.xml,
            **/*/Application.groovy,
        </sonar.coverage.exclusions>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-all</artifactId>
            <version>${groovy.version}</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-gateway</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-reactor-netty</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.okta.spring</groupId>
            <artifactId>okta-spring-boot-starter</artifactId>
            <version>2.1.5</version>
        </dependency>
        <dependency>
            <groupId>com.fnni.util</groupId>
            <artifactId>transaction-site-util</artifactId>
            <version>2.2.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.fnbo.util</groupId>
            <artifactId>util-model</artifactId>
            <version>3.1.0</version>
            <exclusions>
                <exclusion>
                    <artifactId>*</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-core</artifactId>
            <version>${spock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.spockframework</groupId>
            <artifactId>spock-spring</artifactId>
            <version>${spock.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>mockwebserver</artifactId>
            <version>4.9.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
            <version>4.9.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <version>3.4.17</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>2020.0.3</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>2.4.9</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <id>default-prepare-agent</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>default-report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M5</version>
                <configuration>
                    <includes>
                        <!-- By default only files ending in 'Test' will be included, so also include support for Spock style naming convention -->
                        <!-- Oddly enough for Groovy files, *Spec.groovy does not work, but *Spec.java does -->
                        <include>**/*Test.java</include>
                        <include>**/*Spec.java</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <version>1.5</version>
                <configuration>
                    <targetBytecode>17</targetBytecode>
                    <sources>
                        <source>
                            <directory>src/main/groovy</directory>
                            <includes>
                                <include>**/*.groovy</include>
                            </includes>
                        </source>
                    </sources>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>addSources</goal>
                            <goal>compile</goal>
                            <goal>addTestSources</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

However, when I run mvn verify, I get the following error in my IntelliJ console:

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< com.fnni.api:exp-card >------------------------
[INFO] Building exp-card 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.7:prepare-agent (default-prepare-agent) @ exp-card ---
[INFO] argLine set to -javaagent:C:\\Users\\Jared\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.7\\org.jacoco.agent-0.8.7-runtime.jar=destfile=C:\\aws-gitlab\\transaction-site\\exp-card\\target\\jacoco.exec
[INFO] 
[INFO] --- gmavenplus-plugin:1.5:addSources (default) @ exp-card ---
[INFO] 
[INFO] --- gmavenplus-plugin:1.5:addTestSources (default) @ exp-card ---
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ exp-card ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 6 resources
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ exp-card ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- gmavenplus-plugin:1.5:compile (default) @ exp-card ---
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/C:/Users/Jared/.m2/repository/org/codehaus/groovy/groovy/2.5.14/groovy-2.5.14.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Using Groovy 2.5.14 to perform compile.
[INFO] Compiled 69 files.
[INFO] 
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ exp-card ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory C:\aws-gitlab\transaction-site\exp-card\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ exp-card ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\aws-gitlab\transaction-site\exp-card\target\test-classes
[INFO] 
[INFO] --- gmavenplus-plugin:1.5:testCompile (default) @ exp-card ---
[INFO] Using Groovy 2.5.14 to perform testCompile.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.333 s
[INFO] Finished at: 2022-05-12T19:02:20-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.5:testCompile (default) on project exp-card: Error occurred while calling a method on a Groovy class from classpath.: InvocationTargetException: startup failed:
[ERROR] Could not instantiate global transform class org.spockframework.compiler.SpockTransform specified at jar:file:/C:/Users/Jared/.m2/repository/org/spockframework/spock-core/2.1-groovy-3.0/spock-core-2.1-groovy-3.0.jar!/META-INF/services/org.codehaus.groovy.transform.ASTTransformation  because of exception org.spockframework.util.IncompatibleGroovyVersionException: The Spock compiler plugin cannot execute because Spock 2.1.0-groovy-3.0 is not compatible with Groovy 2.5.14. For more information (including enforce mode), see https://docs.spockframework.org (section 'Known Issues').
[ERROR] Spock artifact: file:/C:/Users/Jared/.m2/repository/org/spockframework/spock-core/2.1-groovy-3.0/spock-core-2.1-groovy-3.0.jar
[ERROR] Groovy artifact: file:/C:/Users/Jared/.m2/repository/org/codehaus/groovy/groovy/2.5.14/groovy-2.5.14.jar
[ERROR] 
[ERROR] 1 error
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Process finished with exit code 1

Of course it fails, because it is trying to use Groovy 2.5.14 to compile tests that use Groovy 3.0+

I'm not sure how to fix this. My mvn dependency:tree output looks like this. I can't figure out where, or how it is being pulled transitively. It was coming in from transaction-site-util, but I have that excluded from the build.

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------------< com.fnni.api:exp-card >------------------------
[INFO] Building exp-card 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:3.2.0:tree (default-cli) @ exp-card ---
[INFO] com.fnni.api:exp-card:jar:1.0-SNAPSHOT
[INFO] +- org.codehaus.groovy:groovy-all:pom:3.0.10:compile
[INFO] |  +- org.codehaus.groovy:groovy:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-ant:jar:2.5.14:compile
[INFO] |  |  +- org.apache.ant:ant:jar:1.9.15:compile
[INFO] |  |  +- org.apache.ant:ant-junit:jar:1.9.15:runtime
[INFO] |  |  +- org.apache.ant:ant-launcher:jar:1.9.15:compile
[INFO] |  |  \- org.apache.ant:ant-antlr:jar:1.9.15:runtime
[INFO] |  +- org.codehaus.groovy:groovy-astbuilder:jar:3.0.10:compile
[INFO] |  +- org.codehaus.groovy:groovy-cli-picocli:jar:2.5.14:compile
[INFO] |  |  \- info.picocli:picocli:jar:4.3.2:compile
[INFO] |  +- org.codehaus.groovy:groovy-console:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-datetime:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-docgenerator:jar:2.5.14:compile
[INFO] |  |  \- com.thoughtworks.qdox:qdox:jar:1.12.1:compile
[INFO] |  +- org.codehaus.groovy:groovy-groovydoc:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-groovysh:jar:2.5.14:compile
[INFO] |  |  \- jline:jline:jar:2.14.6:compile
[INFO] |  +- org.codehaus.groovy:groovy-jmx:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-json:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-jsr223:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-macro:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-nio:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-servlet:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-sql:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-swing:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-templates:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-test:jar:2.5.14:compile
[INFO] |  +- org.codehaus.groovy:groovy-test-junit5:jar:2.5.14:compile
[INFO] |  |  +- org.junit.jupiter:junit-jupiter-api:jar:5.7.2:compile
[INFO] |  |  +- org.junit.platform:junit-platform-launcher:jar:1.7.2:compile
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-engine:jar:5.7.2:runtime
[INFO] |  +- org.codehaus.groovy:groovy-testng:jar:2.5.14:compile
[INFO] |  |  \- org.testng:testng:jar:6.13.1:runtime
[INFO] |  |     \- com.beust:jcommander:jar:1.72:runtime
[INFO] |  \- org.codehaus.groovy:groovy-xml:jar:2.5.14:compile
[INFO] +- org.springframework.boot:spring-boot-starter-webflux:jar:2.6.4:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:2.6.4:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:2.6.4:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:2.6.4:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.2.10:compile
[INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.2.10:compile
[INFO] |  |  |  +- org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.3:compile
[INFO] |  |  |  |  \- org.apache.logging.log4j:log4j-api:jar:2.13.3:compile
[INFO] |  |  |  \- org.slf4j:jul-to-slf4j:jar:1.7.36:compile
[INFO] |  |  +- jakarta.annotation:jakarta.annotation-api:jar:1.3.5:compile
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.29:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-json:jar:2.6.4:compile
[INFO] |  |  +- com.fasterxml.jackson.core:jackson-databind:jar:2.11.4:compile
[INFO] |  |  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.11.4:compile
[INFO] |  |  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.11.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.4:compile
[INFO] |  |  +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.4:compile
[INFO] |  |  \- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.4:compile
[INFO] |  +- org.springframework:spring-web:jar:5.3.9:compile
[INFO] |  |  \- org.springframework:spring-beans:jar:5.3.9:compile
[INFO] |  \- org.springframework:spring-webflux:jar:5.3.9:compile
[INFO] +- org.springframework.boot:spring-boot-starter-actuator:jar:2.6.4:compile
[INFO] |  +- org.springframework.boot:spring-boot-actuator-autoconfigure:jar:2.6.4:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-actuator:jar:2.6.4:compile
[INFO] |  \- io.micrometer:micrometer-core:jar:1.6.9:compile
[INFO] |     +- org.hdrhistogram:HdrHistogram:jar:2.1.12:compile
[INFO] |     \- org.latencyutils:LatencyUtils:jar:2.0.3:runtime
[INFO] +- org.springframework.cloud:spring-cloud-starter-gateway:jar:3.0.3:compile
[INFO] |  +- org.springframework.cloud:spring-cloud-starter:jar:3.0.3:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-context:jar:3.0.3:compile
[INFO] |  |  |  \- org.springframework.security:spring-security-crypto:jar:5.4.7:compile
[INFO] |  |  +- org.springframework.cloud:spring-cloud-commons:jar:3.0.3:compile
[INFO] |  |  \- org.springframework.security:spring-security-rsa:jar:1.0.10.RELEASE:compile
[INFO] |  |     \- org.bouncycastle:bcpkix-jdk15on:jar:1.68:compile
[INFO] |  |        \- org.bouncycastle:bcprov-jdk15on:jar:1.68:compile
[INFO] |  \- org.springframework.cloud:spring-cloud-gateway-server:jar:3.0.3:compile
[INFO] |     +- org.springframework.boot:spring-boot-starter-validation:jar:2.6.4:compile
[INFO] |     |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.58:compile
[INFO] |     |  \- org.hibernate.validator:hibernate-validator:jar:6.2.2.Final:compile
[INFO] |     |     +- jakarta.validation:jakarta.validation-api:jar:2.0.2:compile
[INFO] |     |     \- org.jboss.logging:jboss-logging:jar:3.4.3.Final:compile
[INFO] |     \- io.projectreactor.addons:reactor-extra:jar:3.4.3:compile
[INFO] +- org.springframework.boot:spring-boot-starter-reactor-netty:jar:2.6.4:compile
[INFO] |  \- io.projectreactor.netty:reactor-netty-http:jar:1.0.9:compile
[INFO] |     +- io.netty:netty-codec-http:jar:4.1.66.Final:compile
[INFO] |     |  +- io.netty:netty-common:jar:4.1.66.Final:compile
[INFO] |     |  +- io.netty:netty-buffer:jar:4.1.66.Final:compile
[INFO] |     |  +- io.netty:netty-transport:jar:4.1.66.Final:compile
[INFO] |     |  +- io.netty:netty-codec:jar:4.1.66.Final:compile
[INFO] |     |  \- io.netty:netty-handler:jar:4.1.66.Final:compile
[INFO] |     +- io.netty:netty-codec-http2:jar:4.1.66.Final:compile
[INFO] |     +- io.netty:netty-resolver-dns:jar:4.1.66.Final:compile
[INFO] |     |  +- io.netty:netty-resolver:jar:4.1.66.Final:compile
[INFO] |     |  \- io.netty:netty-codec-dns:jar:4.1.66.Final:compile
[INFO] |     +- io.netty:netty-resolver-dns-native-macos:jar:osx-x86_64:4.1.66.Final:compile
[INFO] |     |  \- io.netty:netty-transport-native-unix-common:jar:4.1.66.Final:compile
[INFO] |     +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.66.Final:compile
[INFO] |     \- io.projectreactor.netty:reactor-netty-core:jar:1.0.9:compile
[INFO] |        \- io.netty:netty-handler-proxy:jar:4.1.66.Final:compile
[INFO] |           \- io.netty:netty-codec-socks:jar:4.1.66.Final:compile
[INFO] +- org.springframework.session:spring-session-core:jar:2.4.4:compile
[INFO] |  \- org.springframework:spring-jcl:jar:5.3.9:compile
[INFO] +- com.okta.spring:okta-spring-boot-starter:jar:2.1.5:compile
[INFO] |  +- com.okta.spring:okta-spring-security-oauth2:jar:2.1.5:compile
[INFO] |  |  +- javax.validation:validation-api:jar:2.0.1.Final:compile
[INFO] |  |  +- com.okta.commons:okta-config-check:jar:1.3.0:compile
[INFO] |  |  +- com.okta.commons:okta-commons-lang:jar:1.3.0:compile
[INFO] |  |  +- org.springframework.security:spring-security-config:jar:5.4.7:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-security:jar:2.6.4:compile
[INFO] |  |  +- org.springframework.security:spring-security-oauth2-client:jar:5.4.7:compile
[INFO] |  |  |  +- com.nimbusds:oauth2-oidc-sdk:jar:8.36.2:compile
[INFO] |  |  |  |  +- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile
[INFO] |  |  |  |  +- com.nimbusds:content-type:jar:2.1:compile
[INFO] |  |  |  |  \- com.nimbusds:lang-tag:jar:1.4.4:compile
[INFO] |  |  |  \- org.springframework.security:spring-security-oauth2-core:jar:5.4.7:compile
[INFO] |  |  +- org.springframework.security:spring-security-oauth2-jose:jar:5.4.7:compile
[INFO] |  |  |  \- com.nimbusds:nimbus-jose-jwt:jar:8.22:compile
[INFO] |  |  \- org.springframework.security:spring-security-oauth2-resource-server:jar:5.4.7:compile
[INFO] |  \- com.okta.spring:okta-spring-sdk:jar:2.1.5:compile
[INFO] +- com.fnni.util:transaction-site-util:jar:2.2.0:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:2.6.4:compile
[INFO] |  \- com.fnbo.util:util-eg-model:jar:2.12.0:compile
[INFO] |     \- com.fnbo.util:util-core:jar:2.12.0:compile
[INFO] |        \- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] +- com.fnbo.util:util-model:jar:3.1.0:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-web:jar:2.6.4:compile
[INFO] |  |  \- org.springframework.boot:spring-boot-starter-tomcat:jar:2.6.4:compile
[INFO] |  |     +- org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.58:compile
[INFO] |  |     \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.58:compile
[INFO] |  +- io.springfox:springfox-swagger2:jar:2.9.2:compile
[INFO] |  |  +- io.swagger:swagger-annotations:jar:1.5.20:compile
[INFO] |  |  +- io.swagger:swagger-models:jar:1.5.20:compile
[INFO] |  |  +- io.springfox:springfox-spi:jar:2.9.2:compile
[INFO] |  |  |  \- io.springfox:springfox-core:jar:2.9.2:compile
[INFO] |  |  +- io.springfox:springfox-schema:jar:2.9.2:compile
[INFO] |  |  +- io.springfox:springfox-swagger-common:jar:2.9.2:compile
[INFO] |  |  +- io.springfox:springfox-spring-web:jar:2.9.2:compile
[INFO] |  |  +- com.google.guava:guava:jar:20.0:compile
[INFO] |  |  +- com.fasterxml:classmate:jar:1.5.1:compile
[INFO] |  |  +- org.slf4j:slf4j-api:jar:1.7.36:compile
[INFO] |  |  +- org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO] |  |  +- org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
[INFO] |  |  \- org.mapstruct:mapstruct:jar:1.2.0.Final:compile
[INFO] |  +- io.springfox:springfox-swagger-ui:jar:2.9.2:compile
[INFO] |  +- org.apache.commons:commons-lang3:jar:3.12.0:compile
[INFO] |  \- org.apache.commons:commons-collections4:jar:4.4:compile
[INFO] +- org.spockframework:spock-core:jar:2.1-groovy-3.0:test
[INFO] |  +- org.junit.platform:junit-platform-engine:jar:1.7.2:compile
[INFO] |  |  +- org.apiguardian:apiguardian-api:jar:1.1.0:compile
[INFO] |  |  +- org.opentest4j:opentest4j:jar:1.2.0:compile
[INFO] |  |  \- org.junit.platform:junit-platform-commons:jar:1.7.2:compile
[INFO] |  \- org.hamcrest:hamcrest:jar:2.2:compile
[INFO] +- org.spockframework:spock-spring:jar:2.1-groovy-3.0:test
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:2.6.4:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:2.6.4:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:2.6.4:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.6.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.4.8:compile
[INFO] |  |     \- net.minidev:accessors-smart:jar:2.4.8:compile
[INFO] |  |        \- org.ow2.asm:asm:jar:9.1:compile
[INFO] |  +- jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test
[INFO] |  |  \- jakarta.activation:jakarta.activation-api:jar:1.2.2:test
[INFO] |  +- org.assertj:assertj-core:jar:3.21.0:test
[INFO] |  +- org.junit.jupiter:junit-jupiter:jar:5.7.2:test
[INFO] |  |  \- org.junit.jupiter:junit-jupiter-params:jar:5.7.2:test
[INFO] |  +- org.mockito:mockito-core:jar:4.0.0:test
[INFO] |  |  +- net.bytebuddy:byte-buddy:jar:1.11.22:compile
[INFO] |  |  +- net.bytebuddy:byte-buddy-agent:jar:1.11.22:test
[INFO] |  |  \- org.objenesis:objenesis:jar:3.2:test
[INFO] |  +- org.mockito:mockito-junit-jupiter:jar:4.0.0:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.5.0:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  +- org.springframework:spring-core:jar:5.3.9:compile
[INFO] |  +- org.springframework:spring-test:jar:5.3.9:test
[INFO] |  \- org.xmlunit:xmlunit-core:jar:2.8.4:test
[INFO] +- com.squareup.okhttp3:mockwebserver:jar:4.9.3:test
[INFO] |  +- junit:junit:jar:4.13.2:compile
[INFO] |  |  \- org.hamcrest:hamcrest-core:jar:2.2:compile
[INFO] |  \- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.4.32:test
[INFO] |     \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.4.32:test
[INFO] +- com.squareup.okhttp3:okhttp:jar:4.9.3:test
[INFO] |  +- com.squareup.okio:okio:jar:2.8.0:test
[INFO] |  |  \- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.4.32:test
[INFO] |  \- org.jetbrains.kotlin:kotlin-stdlib:jar:1.4.32:test
[INFO] |     \- org.jetbrains:annotations:jar:13.0:test
[INFO] +- io.projectreactor:reactor-test:jar:3.4.17:test
[INFO] |  \- io.projectreactor:reactor-core:jar:3.4.8:compile
[INFO] |     \- org.reactivestreams:reactive-streams:jar:1.0.3:compile
[INFO] \- org.springframework.security:spring-security-test:jar:5.4.7:test
[INFO]    +- org.springframework.security:spring-security-core:jar:5.4.7:compile
[INFO]    |  +- org.springframework:spring-aop:jar:5.3.9:compile
[INFO]    |  +- org.springframework:spring-context:jar:5.3.9:compile
[INFO]    |  \- org.springframework:spring-expression:jar:5.3.9:compile
[INFO]    \- org.springframework.security:spring-security-web:jar:5.4.7:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.319 s
[INFO] Finished at: 2022-05-12T19:03:49-05:00
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

Even after deleting the groovy artifact from my local .m2 folder, maven downloads version 2.5.14 from my private repo again!

IntelliJ is likely just using whatever maven tells it... so it's also showing like this:

image

Generating a new project with Spring Initializr of course works fine, and it compiles with Groovy 3.0.10. This is happening in my CI pipeline, too, so it seems related to some configuration here and not my local environment specifically.

keeganwitt commented 2 years ago

I apologize for the lack of response to this. I missed it.

Take a look at https://docs.spring.io/spring-boot/docs/1.3.x/reference/html/using-boot-build-systems.html#using-boot-maven-parent-pom vs https://docs.spring.io/spring-boot/docs/1.3.x/reference/html/using-boot-build-systems.html#using-boot-maven-without-a-parent. I think you are combining the two approaches. You should either inherit from the parent or use dependencyManagement, but not both (unless I've misunderstod).

However, the conflict is in spring-boot-dependencies, which uses the groovy.version property on the groovy-bom dependency. This seems to workaround the issue.

<dependencies>
    <dependency>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-all</artifactId>
        <type>pom</type>
        <version>${groovy.version}</version>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-bom</artifactId>
            <type>pom</type>
            <version>${groovy.version}</version>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <type>pom</type>
            <version>2.4.9</version>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

I'm not sure why, but using

<exclusions>
    <exclusion>
        <groupId>org.codehaus.groovy</groupId>
        <artifactId>groovy-bom</artifactId>
    </exclusion>
</exclusions>

doesn't work. Only dependencyManagement works, regardless of whether inheriting from the parent.

keeganwitt commented 1 year ago

Closing stale issue. Please leave a comment if you'd like it reopened.