Gradle can’t find my main class

Asked

Viewed 1,101 times

0

I have the following problem.

:runErro: Não foi possível localizar nem carregar a classe principal LoadWebService
  FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':run'.
> Process 'command 'C:\Program Files\Java\jdk1.8.0_162\bin\java.exe'' 
finished with non-zero exit value 1

build.Gradle

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'

mainClassName = 'LoadWebService'

version = '1.0'

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    compile 'javax.xml.soap:saaj-api:1.3.5'
    compile 'javax.xml.parsers:jaxp-api:1.4.5'

    compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.9.0'

    testRuntime 'junit:junit:4.12'   
    testRuntime 'org.junit.platform:junit-platform-launcher:1.0.3'
    testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.0.3'
    testRuntime 'org.junit.vintage:junit-vintage-engine:4.12.3'
}

My main class

public class LoadWebService
{
    public static void main(String args[])
        ...
}

1 answer

0

Solved! Package was missing along with the class name, Gradle only recognizes, obviously, until the root path 'src/main/java'.

Wrong:

mainClassName = 'LoadWebService'

Right:

mainClassName = 'client.LoadWebService'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.