[GRADLE-938] the uploadArchives task doesn't upload sources and javadoc jars to an Ivy repository Created: 10/May/10 Updated: 04/Jan/13 Resolved: 24/Nov/10 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 0.8 |
Fix Version/s: | 0.9-rc-1 |
Type: | Bug | ||
Reporter: | Michael Parmeley | Assignee: | Hans Dockter |
Resolution: | Fixed | Votes: | 1 |
Description |
When using the following build file the expected behavior is to upload the sources and javadoc jars to an Ivy repository and although the sources and javadoc artifacts are added to the ivy.xml file, the artifacts aren't uploaded to the repository: task packageJavadoc(type: Jar, dependsOn: 'javadoc') { task packageSources(type: Jar) { artifacts { uploadArchives { } |
Comments |
Comment by Michael Parmeley [ 10/May/10 ] |
Guess I should have added a noformat directive around that build file excerpt. Edit permissions seems to be turned off for users so can't fix. |
Comment by Michael Parmeley [ 10/May/10 ] |
The build is successful, no errors are produced. Build output: mjparme:~/java_projects/genesys-communicators:45> gradle uploadAr :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :jar UP-TO-DATE :javadoc UP-TO-DATE :packageJavadoc UP-TO-DATE :packageSources UP-TO-DATE :uploadArchives BUILD SUCCESSFUL Total time: 7.036 secs |
Comment by Michael Parmeley [ 10/May/10 ] |
Running Gradle with -d shows it doesn't even attempt to upload the source and javadoc jars: 11:47:05.030 [main] DEBUG org.gradle.logging.IvyLoggingAdaper - :: SSH :: connecting to redacted... 11:47:05.680 [main] DEBUG org.gradle.logging.IvyLoggingAdaper - :: SSH :: connected to redacted! 11:47:05.683 [main] DEBUG org.gradle.logging.IvyLoggingAdaper - SShRepository: checkExistence called: /wic/web/repos/redacted/genesys-communicators/jars 11:47:06.337 [main] INFO org.gradle.logging.IvyLoggingAdaper - published genesys-communicators to /wic/web/repos/redacted/genesys-communicators/jars/genesys-communicators-1.0.jar 11:47:06.337 [main] DEBUG org.gradle.logging.IvyLoggingAdaper - SShRepository:put called: /wic/web/repos/redacted/genesys-communicators/jars/genesys-communicators-1.0.jar 11:47:06.337 [main] DEBUG org.gradle.logging.IvyLoggingAdaper - SShRepository: checkExistence called: /wic/web/repos/redacted/genesys-communicators/jars 11:47:07.085 [main] INFO org.gradle.logging.IvyLoggingAdaper - published genesys-communicators to /wic/web/repos/redacted/genesys-communicators/jars/genesys-communicators-1.0.jar 11:47:07.085 [main] DEBUG org.gradle.logging.IvyLoggingAdaper - SShRepository:put called: /wic/web/repos/redacted/genesys-communicators/jars/genesys-communicators-1.0.jar 11:47:07.085 [main] DEBUG org.gradle.logging.IvyLoggingAdaper - SShRepository: checkExistence called: /wic/web/repos/redacted/genesys-communicators/jars 11:47:07.751 [main] INFO org.gradle.logging.IvyLoggingAdaper - published genesys-communicators to /wic/web/repos/redacted/genesys-communicators/jars/genesys-communicators-1.0.jar 11:47:07.751 [main] DEBUG org.gradle.logging.IvyLoggingAdaper - SShRepository:put called: /wic/web/repos/redacted/genesys-communicators/ivys/ivy-1.0.xml 11:47:07.752 [main] DEBUG org.gradle.logging.IvyLoggingAdaper - SShRepository: checkExistence called: /wic/web/repos/redacted/genesys-communicators/ivys 11:47:08.454 [main] INFO org.gradle.logging.IvyLoggingAdaper - published ivy to /wic/web/repos/redacted/genesys-communicators/ivys/ivy-1.0.xml 11:47:08.455 [main] DEBUG o.g.a.i.tasks.SkipTaskExecuter - Finished executing task ':uploadArchives' 11:47:08.456 [main] INFO org.gradle.TaskExecutionLogger - 11:47:08.456 [main] DEBUG o.g.e.DefaultTaskGraphExecuter - Timing: Executing the DAG took 4.521 secs 11:47:08.456 [main] INFO org.gradle.launcher.Main - BUILD SUCCESSFUL 11:47:08.456 [main] INFO org.gradle.launcher.Main - Total time: 7.099 secs |
Comment by Michael Parmeley [ 27/May/10 ] |
I have discovered some additional information. Only the last artifact added to the archives is uploaded. So if you produce three jar files: myproject.jar and then add artifacts like this: artifacts { In this case since packageSources was added to archives last the sources (and only the sources) will be uploaded; however, it will be uploaded as myproject.jar rather than myproject-sources.jar. If you switch it so packageJavadoc is the the last artifact added to the archives then the javadocs are upload (and only the javadoc); however, once again it is uploaded as myproject.jar. Please note, that all three jars are correctly created but they are not uploaded correctly (as described above). I hope this makes sense |
Comment by Hans Dockter [ 07/Jun/10 ] |
We have a succeeding integration-test where we something similar. It is the samples/ivypublish one. If you go into this project and execute gradle uploadArchives a binary and source jar will be published to build/repo. Can you still reproduce your problem with the latest Gradle? |
Comment by Michael Parmeley [ 08/Jun/10 ] |
I have downloaded the newest Gradle (0.9 preview 3). I will test with the new version and comment with the results. |
Comment by Michael Parmeley [ 08/Jun/10 ] |
I have tested this with gradle 0.9 preview 3 and the problem remains. The sources and only the sources were uploaded rather than the project artifact and the sources were uploaded with the project artifact name (same behavior as before). Moving the packageJavadoc as the second artifact resulted in the javadocs and only the javadocs being uploaded and it was uploaded with the project artifact name. (This still refers to the build script as shown in the description) I made sure I was testing with preview 3: mjparme:~/java_projects:31> gradle -v ------------------------------------------------------------ Gradle buildtime: Thursday, 3 June 2010 11:51:38 AM EST |
Comment by Hans Dockter [ 23/Jun/10 ] |
The problem is that classifier does not specify the type of the artifact. The type is by default jar. Therefore all jars end up in the subdir jars which represents [type]s. You can specify the type via: archives(sourceJar) { type = 'source' } I'm not sure if the above works with preview-3. It definitely works with the latest Gradle. In any case, if you want to have the classifier as part of the published artifact name you need to specify it in the artifact pattern: |
Comment by Michael Parmeley [ 24/Jun/10 ] |
I changed the artifacts section to this and now the sources and javadocs are uploaded as expected. Guess it was a problem with my build file and not a bug...sorry about that. Here is the syntax: artifacts { archives packageJavadoc { type = 'javadoc' } archives packageSources { type = 'sources' } } Now the only problem is the type isn't set correctly in the ivy.xml. However, I had opened |
Comment by Michael Parmeley [ 24/Jun/10 ] |
Actually my last comment is totally incorrect. The "type" parameter has nothing to do with it. It is totally based off the existence of the "classifier" property and then including the classifier in the repository pattern. |
Comment by Hans Dockter [ 25/Jun/10 ] |
Right. This works only with trunk. And you have to use parentheses: artifacts { archives(packageJavadoc) { type = 'javadoc' } } |