Upload to repository
Hi
I'm new to Gradle (and GradleFx) and so far I'm liking it. I now
trying to upload the result of compilation to my local repository
(maven?, ivy? gradle? I'm not sure). Basically, I want to compile
this library project, install/upload it to my local repository so
my application (swf) project can use it as a dependency. I don't
want to use it as a subproject, because it's not.
Any example on how to do this? The Gradle documentation is farely Java based and I'm not sure how stuff translates to GradleFx.
Also, what does the publish task do?
Thanks!
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Yennick Trevels on 11 Jun, 2012 08:12 PM
You can do this by adding the following code to your build file:
Then you can install them to your local maven repository (in your user directory) with "gradle uploadArchives"
The upload task just copies the content in the build directory to a publish directory. Actually it doesn't do much useful, so we probably should find a better cause for this task.
2 Posted by Olivier on 11 Jun, 2012 08:31 PM
I've tried this snippet from the other post, but it doesn't work. I get this error :
[ant:null] Error reading settings file 'C:\Users\ogroulx\AppData\Local\Temp\gradle_empty_settings3215823816589171383.xml' - ignoring. Error was: C:\Users\ogroulx\AppData\Local\Temp\gradle_empty_settings3215823816589171383.xml (The file was not found)
And nothing is copied to the maven repo.
Also, mavenDeployer require
apply plugin : 'maven'
to work. In fact, here's my configuration :Am I missing something?
Support Staff 3 Posted by Yennick Trevels on 11 Jun, 2012 08:57 PM
mmm, haven't encountered this one before, but I tried it on one of my sample projects and it's giving the same error now. Looks like someone else is getting the same error on the Gradle forums (not GradleFx related): http://forums.gradle.org/gradle/topics/_error_reading_settings_file...
I'll post something in that thread, maybe Peter Niederwieser knows a solution to this problem.
Support Staff 4 Posted by Maxime Cowez on 12 Jun, 2012 08:31 AM
Perhaps you could give it another try with Gradle 1.0 which was released earlier today?
Support Staff 5 Posted by Yennick Trevels on 12 Jun, 2012 08:40 AM
I'll try to track it down this evening by looking from which Gradle version it has been going wrong.
Maxime, aren't you using this same method to upload the artifacts to your local maven repo? and is it still working for you?
Support Staff 6 Posted by Maxime Cowez on 12 Jun, 2012 09:12 AM
Yep, still working fine here with the development build (which should be the same as the 0.5 release)
Gradle 1.0-rc-3
Gradle build time: Sunday, 29 April 2012 23:51:52 o'clock UTC
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.7.0_02 (Oracle Corporation 22.0-b10)
OS: Windows 7 6.1 x86
7 Posted by Olivier on 12 Jun, 2012 12:22 PM
I'll try with Gradle 1.0 today. The only difference with Max I think is that I'm using Windows 7 64 bit.
Support Staff 8 Posted by Yennick Trevels on 12 Jun, 2012 12:25 PM
mmm, I'm also using Windows 7 64 bit, so that could very well be it.
Support Staff 9 Posted by Maxime Cowez on 12 Jun, 2012 12:45 PM
Yennick, your output in the Gradle forum says Win7 x86
10 Posted by Olivier on 12 Jun, 2012 01:56 PM
Nope. Even with Gradle 1.0, the error still occur. From the Gradle forum, bjansen has replied that it's just a way of saying that the artifact doesn't exist on the file system. I'm not sure what to do with that.
Support Staff 11 Posted by Yennick Trevels on 12 Jun, 2012 08:24 PM
I think I see what's going wrong. The uploadArchives task doesn't depend anymore on the compile task (which is implemented by GradleFx, but is a general name used by many plugins to compile something), so it doesn't automatically execute the compile task, which causes the artifact not being added.
Try this piece of code out:
The afterEvaluate statement is needed because the compile task is only added in a later phase, so after the evaluation phase of Gradle.
Then I've defined a task dependency to the compile task, which should make the compile task to execute before the uploadArchives task is being executed.
Maybe this isn't the most optimal solution, so I'm trying to find a better solution, but this should get you going :)
12 Posted by Olivier on 12 Jun, 2012 10:49 PM
Alright, getting somewhere. The maven plugin was complaining about the groupId being empty. I've added a
group
and aversion
property to the build config and it worked! Thanks!Support Staff 13 Posted by Maxime Cowez on 13 Jun, 2012 08:53 AM
So why did it work for me? My guess is because I had executed
gradle compile
manually prior to executinggradle upload
.Yennick Trevels closed this discussion on 15 Aug, 2012 02:04 PM.