0

私のプロジェクトにはjarwarモジュールが含まれています。jarモジュールには、ソース セットmainとが含まれていますgenerated

私のjarモジュールgradle.buildは、以下にリストされているようにソースセットを定義しています:

sourceSets {
    generated
    main {
        compileClasspath += sourceSets.generated.output  // adds the sourceSet to the compileClassPath
        runtimeClasspath += sourceSets.generated.output  // adds the sourceSet to the runtimeClasspath
    }
}

両方のソース セットの出力を jar に配置します。

jar {
    from sourceSets.generated.output
    from sourceSets.main.output
}

モジュール内で、warGretty を使用してビルド内で実行したいと考えています。ファイルはbuild.gradleこんな感じ。

apply plugin: 'war'
apply from: "${rootDir}/gradle/gretty.gradle"

gretty {
    // supported values:
    // 'jetty7', 'jetty8', 'jetty9', 'tomcat7', 'tomcat8'
    servletContainer = 'tomcat8'

    httpPort = 8081
    contextPath = '/wbc'
    realm 'wbc-realm'
    realmConfigFile 'tomcat-users.xml'
}

dependencies {
    compile project(':interfaces')

    compile "org.atmosphere:atmosphere-runtime:${atmosphereVersion}"
    compile "org.springframework:spring-web:${springVersion}"
    compile "javax.servlet:javax.servlet-api:${servletVersion}"

    runtime "org.slf4j:slf4j-log4j12:${slf4jVersion}"
    runtime "log4j:log4j:1.2.17"
}

Gretty を使用してgradle --daemon clean appRunGretty を起動すると、ClassNotFoundException. そのクラスは、私のモジュールのgeneratedソース セットにあります。jarクラスパスに追加するようgrettyに指示するにはどうすればよいですか?

4

1 に答える 1