maven2Gradle: generated task 'packageTests' results in gradle error

I have found that this script block

task packageTests(type: Jar) {
  from sourceSets.test.classes
  classifier = 'tests'
}
artifacts.archives packageTests

provokes the following error when invoking a gradle task

C:\devpacks\dpjw\maven-prj\dpjwApp>gradle dpjw-core:clean
  FAILURE: Build failed with an exception.
  * Where:
Build file 'C:\devpacks\dpjw\maven-prj\dpjw-core\build.gradle' line: 27
  * What went wrong:
A problem occurred evaluating project ':dpjw-core'.
> Cannot get the value of write-only property 'classes' on source set test.
  * Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
  BUILD FAILED

Commenting it out, the generated build script works fine .

(there is a warning about a “provided : true” on a property in a dependency compile block, which obviously should be “provided=true”)

@Szczepan Faber: do you think this is no issue of gradel2Maven but something of my Gradle environment? I’m just wondering because there is no response or comment…

Nope, this is definitely a bug in maven2Gradle. It is still in an incubating stage. To workaround, please manually fix generated build.gradle files before running Gradle build. I’ll extra a jira ticket for this so that we’ll add a coverage for this problem.

It should be sourceSets.test.output, not ‘classes’.

Yes, I know the tool is in incubating state; I just wanted to try it and demonstrate it as a migration way.

BTW: maven2Gradle produces verbose code like this:

compile(group: 'javax.persistence', name: 'ejb3-persistence', version:'1.0') {
  provided = true
}

Think this should be changed.

+1. It should use short notation by default.

Added a ticket for it: GRADLE-2505