Running Gradle Build From Eclipse without a test

I have a gradle build file that uses a java plugin. If I want to call the assembly from the command line and avoid running unit tests, I can simply do this:

gradle build -x test 

However, we will call gradle tasks from Eclipse. Do I need to create a special task for this kind of assembly? How can I do it?

+7
java eclipse gradle
source share
2 answers

In Eclipse > Menu bar "Windows" > Preferences > left side: Gradle> Arguments > Program Arguments > put -x test

and

Under Eclipse > Menu bar "Windows" > Preferences > on the left: Gradle EnIDE> check the box next to the line -x test (--exclude-task test) or use gradle assemble .

See if that helps. Make sure GRADLE_HOME is installed / known for Eclipse.

enter image description here

UPDATE:
This will stop the test task from any project (as global). If you just want to run gradle clean build -x test or the like (from time to time and only in some project), follow these steps:

  • In the GRADLE_HOME / init.d folder, create a global shared file named shenzi.gradle
  • In this shared file, add the following:

     allprojects{ apply plugin: 'java' apply plugin: 'groovy' // blah blah uncomment if you need. //apply plugin: 'pmd' //apply plugin: 'findbugs' //apply plugin: 'checkstyle' //apply plugin: 'jacoco' tasks.withType(Compile) { options.debug = true options.compilerArgs = ["-g"] } // .. // .. more code exists here for commented out lines as shown above, so ignore this in your version // .. task myAliasNoTestBuild() << { // see link below on how to create alias tasks } } 

OR

try this solution: https://www.mail-archive.com/ user@gradle.codehaus.org /msg09173.html

OR

How to prevent gradle creation from running a test task

+8
source share

You can install it locally in eclipse

Right click on build.gradle -> Run As -> Gradle build -> . A window will open.

 Gradle task as :build Program args as -x test 

See below Image .. Everything is installed .. Run now ..

enter image description here

+3
source share

All Articles