You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Thomas Kellerer <sh...@gmx.net> on 2021/03/12 08:29:17 UTC

A little Gradle problem

I have a multi-module Gradle project that compiles fine and runs all tests from the command line.

Building and testing (right-click on the project, then choosing "Test") also works fine from within NetBeans.

However, one Test has the following imports:

    import org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
    import org.springframework.test.context.ContextConfiguration;
    import org.springframework.test.context.junit.jupiter.SpringExtension;

But NetBeans claims the packages don't exist.

build.gradle includes the following modules:

    // Test
    testCompile("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
    testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
    testRuntime("org.junit.platform:junit-platform-launcher:${junitPlatformVersion}")
    testImplementation ("org.springframework.boot:spring-boot-starter-test")
    testImplementation ("org.freemarker:freemarker:${freemarkerVersion}")

when I add the spring boot version:

    testImplementation ("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")

then NetBeans is happy again.

This is a sub-module of a multi-module project and springBootVersion is defined in the properties of the main project, not the module.


I am not really experienced with Gradle, so I don't know whether this is incorrect in Gradle to begin with (but apparently "tolerated" because the project builds) and NetBeans just follows that, or if this is a problem in NetBeans.

Thanks
Thomas




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: A little Gradle problem

Posted by Thomas Kellerer <sh...@gmx.net>.
Mark A. Flacy schrieb am 16.03.2021 um 02:44:
> Greetings,
>
> The plugins you are using will impact what is going on with Gradle.  You
> should tell us about them as well.
>
> I know there is at least one protobuf plugin that NetBeans is not currently
> able to handle. (Well, 12.1 couldn't; I haven't checked against 12.3.)
>


The main project contains:

plugins {
    id "com.cinnober.gradle.semver-git" version "${semverPluginVersion}"
    id "com.bmuschko.docker-remote-api" version "${dockerRemoteApiPluginVersion}"
    id "maven-publish"
}


The sub-module in question contains

plugins {
    id "org.springframework.boot" version "${springBootVersion}"
    id "io.spring.dependency-management" version "${dependencyManagementVersion}"
    id 'java-library'
    id 'eclipse'
}

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: A little Gradle problem

Posted by "Mark A. Flacy" <mf...@verizon.net.INVALID>.
Greetings,

The plugins you are using will impact what is going on with Gradle.  You 
should tell us about them as well.

I know there is at least one protobuf plugin that NetBeans is not currently 
able to handle. (Well, 12.1 couldn't; I haven't checked against 12.3.)

-- 
Mark A. Flacy
mflacy@verizon.net

On Monday, March 15, 2021 5:23:03 AM CDT Thomas Kellerer wrote:
> Mark A. Flacy schrieb am 15.03.2021 um 10:32:
> > Which version of Gradle are you using?  What does the parent project's
> > build.gradle look like?
> 
> I am using Gradle 6.7
> 
> The sub module only contains a build.gradle with the following dependencies:
> 
>     dependencies {
> 
>         // Spring
>         implementation
> "org.springframework.boot:spring-boot:${springBootVersion}" implementation
> "org.springframework.boot:spring-boot-autoconfigure:${springBootVersion}"
> implementation "commons-io:commons-io:${commonsIoVersion}" implementation
> "org.apache.commons:commons-lang3:${commonsLangVersion}" implementation
> "org.apache.commons:commons-text:1.9"
>         implementation "org.freemarker:freemarker:${freemarkerVersion}"
> 
>         // Logging
>         implementation "ch.qos.logback:logback-core:${logbackVersion}"
>         implementation "ch.qos.logback:logback-classic:${logbackVersion}"
>         implementation "org.slf4j:slf4j-api:${slf4jVersion}"
> 
>         // Jackson
>      
> implementation("com.fasterxml.jackson.core:jackson-annotations:${jacksonVer
> sion}") implementation
> "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}" implementation
> "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
> 
>         // Test
>         testCompile("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
>        
> testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
> testRuntime("org.junit.platform:junit-platform-launcher:${junitPlatformVers
> ion}") testImplementation
> ("org.springframework.boot:spring-boot-starter-test") testImplementation
> ("org.freemarker:freemarker:${freemarkerVersion}")
> 
>     }
> 
> 
> The parent's build.gradle does not contain any dependencies and its
> gradle.properties contains this:
> 
> 
>     group = .....
>     version = 0.1.0
> 
>     # Plugin versions
>     semverPluginVersion=2.3.1
>     dockerRemoteApiPluginVersion=6.1.4
>     dockerComposePluginVersion=0.14.0
>     springBootVersion=2.4.0
>     hibernateCoreVersion=5.4.21.Final
>     commonsIoVersion=2.8.0
>     commonsLangVersion=3.11
>     quartzVersion=2.3.2
> 
>     dependencyManagementVersion=1.0.10.RELEASE
>     wsdl2javaVersion=0.12
>     jacksonVersion=2.12.1
>     httpClientVersion=4.5.12
>     logbackVersion=1.2.3
>     slf4jVersion=1.7.30
>     freemarkerVersion=2.3.31
> 
>     # Java
>     sourceCompatibility = 11
>     targetCompatibility = 11
> 
>     # Test
>     junitVersion=5.5.2
>     junitPlatformVersion=1.5.2
> 
> 
> 
> It's absolutely no big deal to adjust the sub-module's build.gradle - I am
> just curious why Gradle is happy with this, but NetBeans isn't
> 
> Regards
> Thomas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
> 
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: A little Gradle problem

Posted by Thomas Kellerer <sh...@gmx.net>.
Mark A. Flacy schrieb am 15.03.2021 um 10:32:
> Which version of Gradle are you using?  What does the parent project's
> build.gradle look like?
>

I am using Gradle 6.7

The sub module only contains a build.gradle with the following dependencies:

    dependencies {

        // Spring
        implementation "org.springframework.boot:spring-boot:${springBootVersion}"
        implementation "org.springframework.boot:spring-boot-autoconfigure:${springBootVersion}"
        implementation "commons-io:commons-io:${commonsIoVersion}"
        implementation "org.apache.commons:commons-lang3:${commonsLangVersion}"
        implementation "org.apache.commons:commons-text:1.9"
        implementation "org.freemarker:freemarker:${freemarkerVersion}"

        // Logging
        implementation "ch.qos.logback:logback-core:${logbackVersion}"
        implementation "ch.qos.logback:logback-classic:${logbackVersion}"
        implementation "org.slf4j:slf4j-api:${slf4jVersion}"

        // Jackson
      implementation("com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}")
        implementation "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
        implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"

        // Test
        testCompile("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
        testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
        testRuntime("org.junit.platform:junit-platform-launcher:${junitPlatformVersion}")
        testImplementation ("org.springframework.boot:spring-boot-starter-test")
        testImplementation ("org.freemarker:freemarker:${freemarkerVersion}")

    }


The parent's build.gradle does not contain any dependencies and its gradle.properties contains this:


    group = .....
    version = 0.1.0

    # Plugin versions
    semverPluginVersion=2.3.1
    dockerRemoteApiPluginVersion=6.1.4
    dockerComposePluginVersion=0.14.0
    springBootVersion=2.4.0
    hibernateCoreVersion=5.4.21.Final
    commonsIoVersion=2.8.0
    commonsLangVersion=3.11
    quartzVersion=2.3.2

    dependencyManagementVersion=1.0.10.RELEASE
    wsdl2javaVersion=0.12
    jacksonVersion=2.12.1
    httpClientVersion=4.5.12
    logbackVersion=1.2.3
    slf4jVersion=1.7.30
    freemarkerVersion=2.3.31

    # Java
    sourceCompatibility = 11
    targetCompatibility = 11

    # Test
    junitVersion=5.5.2
    junitPlatformVersion=1.5.2



It's absolutely no big deal to adjust the sub-module's build.gradle - I am just curious why Gradle is happy with this, but NetBeans isn't

Regards
Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: A little Gradle problem

Posted by "Mark A. Flacy" <mf...@verizon.net.INVALID>.
Which version of Gradle are you using?  What does the parent project's 
build.gradle look like?

-- 
Mark A. Flacy
mflacy@verizon.net

On Monday, March 15, 2021 4:24:14 AM CDT Thomas Kellerer wrote:
> Andy Turner schrieb am 12.03.2021 um 20:05:
> > The line:
> >     testImplementation
> > ("org.springframework.boot:spring-boot-starter-test")
> > 
> > is unusual, and the one you add:
> >     testImplementation
> > ("org.springframework.boot:spring-boot-starter-test:${springBootVersion}"
> > )
> > 
> > is more like the others.
> 
> Yes, I understand that.
> 
> But why does Gradle accept it, but NetBeans isn't able to resolve the
> classpath correctly?
> 
> "gradlew build" on the command line works without problems even with the
> "unusual" line, so Gradle seems to setup the classpath correctly, but
> NetBeans does not.
> 
> Thomas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
> 
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: A little Gradle problem

Posted by Thomas Kellerer <sh...@gmx.net>.
Andy Turner schrieb am 12.03.2021 um 20:05:
> The line:
>     testImplementation ("org.springframework.boot:spring-boot-starter-test")
>
> is unusual, and the one you add:
>     testImplementation ("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")
>
> is more like the others.

Yes, I understand that.

But why does Gradle accept it, but NetBeans isn't able to resolve the classpath correctly?

"gradlew build" on the command line works without problems even with the "unusual" line,
so Gradle seems to setup the classpath correctly, but NetBeans does not.

Thomas


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: A little Gradle problem

Posted by Andy Turner <A....@leeds.ac.uk>.
It just looks like in:

    // Test
    testCompile("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
    testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
    testRuntime("org.junit.platform:junit-platform-launcher:${junitPlatformVersion}")
    testImplementation ("org.springframework.boot:spring-boot-starter-test")
    testImplementation ("org.freemarker:freemarker:${freemarkerVersion}")

The line:
    testImplementation ("org.springframework.boot:spring-boot-starter-test")

is unusual, and the one you add:
    testImplementation ("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")

is more like the others.

HTH

Andy
________________________________
From: Thomas Kellerer <sh...@gmx.net>
Sent: 12 March 2021 08:29
To: NetBeans Users <us...@netbeans.apache.org>
Subject: A little Gradle problem

I have a multi-module Gradle project that compiles fine and runs all tests from the command line.

Building and testing (right-click on the project, then choosing "Test") also works fine from within NetBeans.

However, one Test has the following imports:

    import org.springframework.boot.test.context.ConfigDataApplicationContextInitializer;
    import org.springframework.test.context.ContextConfiguration;
    import org.springframework.test.context.junit.jupiter.SpringExtension;

But NetBeans claims the packages don't exist.

build.gradle includes the following modules:

    // Test
    testCompile("org.junit.jupiter:junit-jupiter-api:${junitVersion}")
    testRuntime("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")
    testRuntime("org.junit.platform:junit-platform-launcher:${junitPlatformVersion}")
    testImplementation ("org.springframework.boot:spring-boot-starter-test")
    testImplementation ("org.freemarker:freemarker:${freemarkerVersion}")

when I add the spring boot version:

    testImplementation ("org.springframework.boot:spring-boot-starter-test:${springBootVersion}")

then NetBeans is happy again.

This is a sub-module of a multi-module project and springBootVersion is defined in the properties of the main project, not the module.


I am not really experienced with Gradle, so I don't know whether this is incorrect in Gradle to begin with (but apparently "tolerated" because the project builds) and NetBeans just follows that, or if this is a problem in NetBeans.

Thanks
Thomas




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists