kumc-bmi/naaccr-tumor-data

support gradle newer than 5.3.1: build fails ("cant find Main") with gradle 6.8

Opened this issue · 1 comments

dckc commented

@jayped007 reports...

The jar file that was being built using gradle 6.8 on Centos 7 ... was invalid. It did not contain the Groovy files it needed and it didn't have the manifest correct. So I would get these "cant find Main" attribute errors or "cant find gpc.TumorFile" errors. Was driving me nuts.

Finally, I started hacking build.gradle, and the following worked for me, I had to put everything inside of a "jar" enclosure, whereas before it was not like that, there was a "with jar" statement around the end of the task.

So ... just fyi, if you move to current Gradle ... I think you will have the same issue that I was fighting.

===> my modification (not much, but important)

task fatjar(type: Jar) {
    group = 'build'
    jar {
        manifest {
            attributes 'Main-Class': 'gpc.TumorFile'
        }

        from {
            configurations
                .runtime
                .collect { it.isDirectory() ? it : zipTree(it) }
        }

        exclude 'META-INF/*.RSA', 'META-INF/*.SF', 'META-INF/*.DSA'
    }
}
dckc commented

support for newer versions of gradle is a possible enhancement

But the build instructions in CONTRIBUTING are to use ./gradlew fatjar and I'm pretty sure that will use 5.3.1 per gradle-wrapper.properties.