Generated POM does not include dependencies if POM is customized before applying Java plugin


(Edward Yakop) #1

As per subject says,

build.gradle contains the following declarations @@@

dependencies {

compile ‘com.adobe.blazeds:blazeds-common:4.0.0.14931’

compile ‘com.adobe.blazeds:blazeds-core:4.0.0.14931’

testCompile ‘junit:junit:4.9’

}

uploadArchives {

repositories {

mavenDeployer {

repository( url: “someURL” ) {

}

pom.project {

// … Custom declarations on developers etcs

}

}

}

}

} @@@

Expected result: * When @@@gradle upload@@@ is invoked, the expected behavior is to have both my custom declarations (developers, licenses, etcs) and project dependencies to be included in the uploaded pom.xml

Current result: * Custom declarations are included, but the project dependencies are not included

Do note that when pom.project declaration is removed, the project dependencies are included in the uploaded pom.xml.


(Peter Niederwieser) #2

Usually this works just fine. Can you provide a fully self-contained example that demonstrates the problem? Please use HTML code tags when pasting code. Also please paste the output of ‘gradle -v’.


(Edward Yakop) #3

The simplest project can be downloaded from here https://docs.google.com/open?id=0BwZ5wsZTtnH4SnRJcC14bWpDa2c

$ gradle upload -v

------------------------------------------------------------ Gradle 1.2 ------------------------------------------------------------

Gradle build time: Wednesday, September 12, 2012 10:46:02 AM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy: 2.2.0 JVM: 1.6.0_32 (Sun Microsystems Inc. 20.7-b02) OS: Windows 7 6.1 amd64


(Edward Yakop) #4

Hi Peter,

Did you manage to reproduce the error in your environment?


(Peter Niederwieser) #5

The problem occurs if the POM is customized before the ‘java’ plugin has been applied. I’ve created a JIRA for this. In the meantime, make sure to first apply the plugin.


(Edward Yakop) #6

The problem with this method is, it doesn’t work with my project. My project has flex and java component, due to some task name conflict, I can’t do ‘apply plugin: ‘java’’ ‘apply plugin: ‘gradlefx’’

The following error message occurred when gradle build is invoked: '$ !g gradle clean

FAILURE: Build failed with an exception.

  • Where: Build file ‘C:\workspace\pons\pons-swc\build.gradle’ line: 11

  • What went wrong: A problem occurred evaluating project ‘:pons-swc’. > Cannot add task ‘:pons-swc:build’ as a task with that name already exists.

  • 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: 3.82 secs’

Anyway, for a workaround, I’ll re-declare the maven deployer in deploy-able module.

Thanks for the reply.


(Peter Niederwieser) #7

Looks like a problem with the ‘gradlefx’ plugin. It probably shouldn’t add a ‘build’ task if one already exists.