Folks, I have a groovy project which generates a jar. When uploading the jar to a maven repo, the generated pom.xml file does not define the groovy dependency.
What’s the easiest way to fix this?
PS: running M7 PS2: Here is my upload task:
uploadArchives {
repositories {
mavenDeployer {
repository(url: libsRepoUrl){
authentication(userName: libsRepoUsername, password: libsRepoPassword)
}
pom.version = project.releaseVersion
pom.groupId = project.group
pom.artifactId = project.archivesBaseName
}
}
}
A simple way to achieve this is to add Groovy as a compile dependency (not just as a groovy dependency).
Maybe we shouldn’t just map the compile configuration to the Maven compile scope but also its super configurations.
Hi Peter,
I tried your idea but my build failed with the following error:
edovales-macbook:VersionManager erickdovale$ gradle clean build The SourceSet.getClassesDir() method is deprecated and will be removed in the next version of Gradle. You should use the getOutput().getClassesDir() method instead. :clean :compileJava UP-TO-DATE :compileGroovy
FAILURE: Build failed with an exception.
-
What went wrong: Execution failed for task ‘:compileGroovy’. Cause: You must assign a Groovy library to the groovy configuration!
-
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 21.074 secs
What I ended up doing is adding a mapping like:
conf2ScopeMappings.add (1, configurations.groovy, ‘compile’)
Actually,
I think misread your reply. You mean adding groovy to both, compile and groovy configurations?
I tried your idea but my build failed with the following error:
As I tried to explain, you have to add the Groovy dependency to both configurations.
What I ended up doing is adding a mapping like:
Yes, that’s another possibility.