Possible bug in java plugin Gradle milestone 9


(Derek Christman) #1

When I assign a list of files to “metaInf” in a java build file the jar task is failing with “java.lang.IllegalArgumentException: Neither path nor baseDir may be null or empty string.” The project is a multi project build, where the root project produces no artifacts (maintains configuration). One subproject is a war project, and the other subproject a java project. The war project has a dependency on the java project, expressed as:

dependencies {

runtime project(path: ‘:javaproj’, configuration: ‘archives’) }

The java project build.gradle file contains only the following:

metaInf << new File(‘src/main/META-INF’).listFiles()

In the docs (http://gradle.org/docs/current/userguide/java_plugin.html) section 23.13.2. it gives the sample “metaInf << new FileSet(someDir)” which actually will not compile. Neither will using the “from()” method instead of FileSet, thus I had resorted to just using Java/Groovy above. After much pain I finally found a fix/work around/“the correct way” by replacing this line with:

jar {

metaInf {

from ‘src/main/META-INF’

} }

The error message mentioned to report this error via the forums; should I/can I file this as an issue, or if it is determined that this behavior is correct, at least correct the documentation? I do have a simple example set up that reproduces the issue if desired.

Thanks,

Derek


(Luke Daley) #2

Hi Derek,

The documentation was plain wrong. I’ve just removed it, as the example above supersedes it. The code you came up with is the best solution.

Thanks for the detailed report.


The process for reporting issues is to do exactly what you did; raise a problem on the forums. From there, one of the developers exports to JIRA and links it back to the forum if necessary.

We are in the process of codifying this process and will have more helpful guides/info on it available soon.