Gradle reports BUILD SUCCESSFUL, however I can not locate any .class files

ぐ巨炮叔叔 提交于 2020-01-05 04:41:12

问题


I am attempting to use Gradle (for the first time) for a multiproject java build.

I have created a settings.gradle file with all the project names. I have also create a very basic build.gradle file. To my surprise when I run gradle build. It returns BUILD SUCCESSFUL. Jars are created in the build\libs folder. What is puzzling to me is that no .class files exists. Also I have been unable to get any kind of Junit results or xml output.

I'm wondering if this is really building correctly. For now this is my very basic build.gradle file. Any input is appreciated, thanks.

subprojects {
    apply plugin: 'java'
    apply plugin: 'eclipse-wtp'

    version = '1.0'

    compileJava.destinationDir = file("$buildDir/output/classes")

    repositories {

    }

    dependencies {
    }

    test {      
        testLogging {
            exceptionFormat 'full'
            events 'started', 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
        }
    }

    jar {
        manifest.attributes provider: 'gradle'
    }
}

As requested this is my project directory structure.

MainProject
build.gradle
settings.gradle
--SubProject1
----src
--Subproject2
----src
.
.
.


回答1:


Make sure your subprojects are laid out according to the defaults for the Java plugin

( see section 23.4 Project Layout in http://www.gradle.org/docs/current/userguide/java_plugin.html)

or tell the plugin where you have put things

( see section 23.4.1. Changing the project layout )



来源:https://stackoverflow.com/questions/21538055/gradle-reports-build-successful-however-i-can-not-locate-any-class-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!