У меня ниже упоминается конфигурация gradle.Когда я использую любую команду сборки, она печатает.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Моя конфигурация gradle:
buildscript {
ext {
springBootVersion = '2.0.5.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'com.dvsts.nextgen.restcisco'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
jar {
manifest {
attributes "Main-Class": "com.dvsts.nextgen.restcisco.Application"
}
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}
task customFatJar(type: Jar) {
manifest {
attributes 'Main-Class': 'com.dvsts.nextgen.restcisco.Application'
}
baseName = 'ciso-cdr-rest'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-web')
runtime('org.springframework.boot:spring-boot-devtools')
testCompile('org.springframework.boot:spring-boot-starter-test')
// https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.3.4'
}
configurations {
jaxb
}
dependencies {
jaxb "com.sun.xml.bind:jaxb-xjc:2.1.7"
}
task genJaxb {
ext.sourcesDir = "${buildDir}/generated-sources/jaxb"
ext.classesDir = "${buildDir}/classes/jaxb"
ext.schema = "${projectDir}/src/main/resources/xsds/cospace.xsd"
outputs.dir classesDir
doLast() {
project.ant {
// Create output directories
mkdir(dir: sourcesDir)
mkdir(dir: classesDir)
taskdef name: 'xjc', classname: 'com.sun.tools.xjc.XJCTask', classpath: configurations.jaxb.asPath
xjc(destdir: sourcesDir, schema: schema, 'package': 'com.gdpotter.sample.iso_20022.seev_031_01_07') {
produces(dir: sourcesDir, includes: '**/*.java')
}
javac(destdir: classesDir, source: 1.8, target: 1.8, debug: true,
debugLevel: 'lines,vars,source',
includeantruntime: false,
classpath: configurations.jaxb.asPath) {
src(path: sourcesDir)
include(name: '**/*.java')
include(name: '*.java')
}
copy(todir: classesDir) {
fileset(dir: sourcesDir, erroronmissingdir: false) {
exclude(name: '**/*.java')
}
}
}
}
}
dependencies {
compile(files(genJaxb.classesDir).builtBy(genJaxb))
jaxb 'com.sun.xml.bind:jaxb-xjc:2.1.7'
}
compileJava.dependsOn 'genJaxb'
jar {
from genJaxb.classesDir
}
Я перепробовал все возможные комбинации.Я хочу, чтобы, когда происходит сборка, сгенерированные jaxb java-классы должны быть добавлены в classpath.
, а в случае сборки gradle они должны быть включены в jar-файл.