- Add classpath in manifest using Gradle
- "The filename or extension is too long error" using gradle
edit < /h1>
experimenting with
task testPathingJar(type: Jar) {
appendix = "testPathing"
doFirst {
manifest {
attributes "Class-Path": configurations.testCompile.files.join(" ")
}
}
}
compileTestScala {
dependsOn(testPathingJar)
classpath = files(testPathingJar.archivePath)
}
task pathingJar(type: Jar) {
appendix = "pathing"
doFirst {
manifest {
attributes "Class-Path": configurations.compile.files.join(" ")
}
}
}
compileScala {
dependsOn(pathingJar)
classpath = files(pathingJar.archivePath)
}
build {
dependsOn pathingJar
doFirst {
classpath = files("$buildDir/classes/main", "$buildDir/resources/main", pathingJar.archivePath)
}
}
< /code>
, к сожалению, терпит неудачу во время ShadowJar < /code>, поскольку манифестные трюки, представленные в нескольких ссылках, имеют проблему со Scala: < /p>
Cannot infer Scala class path because no Scala library Jar was found. Does project ':tma-mobility-frequencyCounting' declare dependency to scala-library? Searched classpath: file collection.
< /code>
Попытка: < /p>
jar {
manifest {
attributes(
"Class-Path": configurations.compileOnly.collect { it.getName() }.join(' '))
}
}
fails for task `shadowDistZip` when executing `gradle build` with:
java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0_131\bin\java.exe" (in directory "D:\users\username\development\projects\projectName\Code\spark\module_name"): CreateProcess error=206, Der Dateiname oder die Erweiterung ist zu lang
moving gradle user home to the root (also the project) of the partition:
.\gradlew.bat build --gradle-user-home D:\projects\gradleHome
fails with the same error for task `test`.
When trying the strategy of https://github.com/jhipster/generator-j ... 4324/files like:
task pathingJar(type: Jar) {
dependsOn configurations.runtime
appendix = 'pathing'
doFirst {
manifest {
attributes 'Class-Path': configurations.runtime.files.collect {
it.toURL().toString().replaceFirst(/file:\/+/, '/')
}.join(' ')
}
}
}
build {
dependsOn pathingJar
doFirst {
classpath = files("$buildDir/classes/main", "$buildDir/resources/main", pathingJar.archivePath) }
}
task pathingJarTest(type: Jar) {
dependsOn configurations.runtime
appendix = 'pathing'
doFirst {
manifest {
attributes 'Class-Path': configurations.runtime.files.collect {
it.toURL().toString().replaceFirst(/file:\/+/, '/')
}.join(' ')
}
}
}
test {
dependsOn pathingJarTest
doFirst {
classpath = files("$buildDir/classes/main", "$buildDir/resources/main", pathingJarTest.archivePath) }
}
< /code>
Не удастся с < /p>
Caused by: org.gradle.api.GradleException: There were failing tests. See the report at: file:///C:/tmp/projectName/moduleName/reports/tests/test/index.html
< /code>
Несмотря на то, что этот файл никогда не создан < /p>
Пробуйте еще одну вещь: жирная банка, включающая все тестовые случаи: < /p>
task fatTestJar(type: Jar) {
baseName = project.name + '-test-all'
from {
from { configurations.testRuntime.collect { it.isDirectory() ? it : zipTree(it) }}
from sourceSets.test.output
}
with jar
}
< /code>
Однако это еще не компилируется. < /p>
Подробнее здесь: https://stackoverflow.com/questions/507 ... is-too-lon