-
Notifications
You must be signed in to change notification settings - Fork 208
aditional artifacts examples #24
Comments
You want to publish 1 jar with another jar inside it? |
Neither, just a new jar file, with a different classifier - a new artifact. Something like this:
|
By the way, I currently have the task mentioned above and this
which generates the -deobf.jar file. I just wanted to have it published together with the other 3 artifacts already being published :) |
I'm not 100% sure but this wiki page might be useful https://github.com/novoda/bintray-release/wiki/Defining-a-custom-Publication I think you need to define your own publication and add the atrifacts you want in there |
I read that, but I don't know how to define my publication. Perhaps I'm not seeing something obvious because I don't know much about groovy and gradle - that's why the examples would be helpful, not just to me, but anyone in a similar situation :) |
I assume you're working on a java project (not an android project) See here you can use just a string to define an artifact https://github.com/novoda/bintray-release/blob/master/core/src/main/groovy/com/novoda/gradle/release/AndroidArtifacts.groovy#L29 So if you know what's the path to the jar you generate (the I'm not exactly sure about the syntax but something like: class JavaWithDeobfArtifacts extends JavaArtifacts {
@Override
def all(Project project) {
def list = super.all(project)
list.add(deobfuscatedJar())
return list
}
def deobfuscatedJar(Project project) {
"$project.buildDir/foobar-deobf.jar" // TODO: Replace with the right path
}
} and then you should be able to use that with something like this: void attachArtifacts(Project project) {
Artifacts artifacts = new JavaWithDeobfArtifacts()
String projectVersion = getString(project, 'version', project.publish.version)
project.publishing {
publications {
maven(MavenPublication) {
groupId project.publish.groupId
artifactId project.publish.artifactId
version projectVersion
artifacts.all(project).each {
delegate.artifact it
}
from artifacts.from(project)
}
}
}
} and then call I haven't checked that code so it might not work or be incomplete. Let me know if that works and if it doesn't I'll try to replicate it with a simple project |
Yes, it is a Java (Scala, actually, but it is the same from this perspective). Where should I put my custom |
the easiest would be to put it inside your |
I should have though of that XD
|
I raised a PR to fix the task name issue, #42 |
@jcranky try again but using |
I'm still a bit lost on what I should do. I tried some stuff here and the best I got until now is
My current working build is here: https://github.com/easyforger/easyforger/blob/master/build.gradle, but without the custom publishing. Locally, the |
have you also selected the publication like - publish {
userOrg = 'novoda'
groupId = 'com.novoda'
artifactId = rootProject.name
version = project.version
description = 'Super duper easy way to release your Android and other artifacts to bintray'
website = "https://github.com/novoda/${rootProject.name}"
publishing {
publications {
superPublication(MavenPublication) {
groupId project.publish.groupId
artifactId project.publish.artifactId
version project.publish.version
Artifacts artifacts = new JavaArtifacts()
artifacts.all(it.name, project).each {
delegate.artifact it
}
from artifacts.from(project)
}
}
}
publications =["superPublication"]
} The error seems like you've reused the |
You mean the |
For a quick try, what I did:
With that, I couldn't get the results from the
And got:
Perhaps I'm not doing something I should be doing? Also, IDEA shows me the |
After some investigation, the problem seems to be that I was using I still have to do some more testing, but how can we have the same results with both thanks! |
sorry for the delay the "maven" part of "publishMavenPublicationToMavenLocal" is the publication name, so in the example I gave it was called "superPublication" would be "publishSuperPublicationPublicationToMavenLocal" The hope that helps! |
Perfect, thank you!
I still find it a bit verbose, but it works :D thank you! |
Added a short wiki (https://github.com/novoda/bintray-release/wiki/Defining-an-additional-artifact) |
I just updated to version 0.3.5 and the custom publication discussed above seems to be broken now:
Should I open a new issue? Or perhaps I missed something in the update process? |
Uhmmm not sure if this is the same thing. Using
Reverting to |
I could get around this by applying the 'maven-publish' plugin explicitly |
I'm publishing a java project, with jar, sources and javadoc. I also want to publish an extra jar file, for which I already have the custom task. The wiki mentions I should be able to configure my own publishing to do this kind of thing, but I'm not sure how. An example in the wiki would be great.
I'm pretty sure I should be able to extend JavaArtifacts for that, since I what I want is that plus the new jar. Perhaps I lost because I'm new to groovy and gradle, so again, an example would help a lot.
thanks!
The text was updated successfully, but these errors were encountered: