Comments (23)
I could get around this by applying the 'maven-publish' plugin explicitly
from bintray-release.
You want to publish 1 jar with another jar inside it?
Or you want to publish 1 jar with a dependency on another jar?
from bintray-release.
Neither, just a new jar file, with a different classifier - a new artifact. Something like this:
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
}
from bintray-release.
By the way, I currently have the task mentioned above and this
tasks.build.dependsOn('deobfJar')
which generates the -deobf.jar file. I just wanted to have it published together with the other 3 artifacts already being published :)
from bintray-release.
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
from bintray-release.
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 :)
from bintray-release.
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 -deobf.jar
one) then I think you can just extend the JavaArtifacts
class and override the all()
method to return the super plus your own artifact.
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 attachArtifacts()
from your gradle script after applying the release plugin (probably after defining the publish
closure).
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
from bintray-release.
Yes, it is a Java (Scala, actually, but it is the same from this perspective). Where should I put my custom JavaWithDeobfArtifacts
?
from bintray-release.
the easiest would be to put it inside your build.gradle
file directly
from bintray-release.
I should have though of that XD
I tried it and it didn't work with this error:
Caused by: org.gradle.api.InvalidUserDataException: Cannot add task ':sourcesJar' as a task with that name already exists.
from bintray-release.
I raised a PR to fix the task name issue, #42
from bintray-release.
@jcranky try again but using 0.2.10
and see if there's more luck
from bintray-release.
I'm still a bit lost on what I should do. I tried some stuff here and the best I got until now is
Caused by: org.gradle.api.InvalidUserDataException: Maven publication 'maven' cannot include multiple components
My current working build is here: https://github.com/easyforger/easyforger/blob/master/build.gradle, but without the custom publishing. Locally, the publish / publishing / publications
doesn't seem to have any effect =(
from bintray-release.
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 maven
publication name, it'll need to be unique!
from bintray-release.
You mean the publications =["superPublication"]
line, right? I had it, but it seemed to be ignored. I'll try again later today from scratch and if I get different results I'll post back here.
from bintray-release.
For a quick try, what I did:
- update bintray-release to 0.2.10:
classpath 'com.novoda:bintray-release:0.2.10'
- Add this import:
import com.novoda.gradle.release.*
- added @ouchadam 's publishing block, and set the publications as well
With that, I couldn't get the results from the superPublication
to run. I executed:
./gradlew --stacktrace clean build publishMavenPublicationToMavenLocal
And got:
:build
:generatePomFileForMavenPublication
:mavenJavadocJar
:mavenSourcesJar
:publishMavenPublicationToMavenLocal
Perhaps I'm not doing something I should be doing?
Also, IDEA shows me the publishing
inside of the publish
closure as underlined gray, meaning it doesn't seem to find it.
from bintray-release.
After some investigation, the problem seems to be that I was using publishMavenPublicationToMavenLocal
. With bintrayUpload
the custom publication is found.
I still have to do some more testing, but how can we have the same results with both publishMavenPublicationToMavenLocal
and bintrayUpload
? The idea is to use local maven publishing to test stuff, and the bintray upload when everything is ready.
thanks!
from bintray-release.
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 ...publicationToMavenLocal
task is done by default when using dryRun=true (which is also the default setting for bintrayUpload
) which means bintrayUpload
will always do a maven local deploy unless you provide dryRun=false
and in that case it'll upload to bintray
hope that helps!
from bintray-release.
Perfect, thank you! bintrayUpload
with dryRun
fit the bill just fine. This is how I ended up setting up my publication, in case you want to use it as an example in the documentation:
import com.novoda.gradle.release.*
def deobfJarPublish(String publicationName, Project project) {
project.task(publicationName + 'DeobfJar', type: Jar) {
classifier = 'deobf'
from sourceSets.main.output
}
}
publish {
...
dryRun = true
publishing {
publications {
deobfPublication(MavenPublication) {
groupId project.publish.groupId
artifactId project.publish.artifactId
publishVersion project.publish.publishVersion
Artifacts artifacts = new JavaArtifacts()
(artifacts.all(it.name, project) + deobfJarPublish(it.name, project)).each {
delegate.artifact it
}
from artifacts.from(project)
}
}
}
publications = ['deobfPublication']
}
I still find it a bit verbose, but it works :D
thank you!
from bintray-release.
Added a short wiki (https://github.com/novoda/bintray-release/wiki/Defining-an-additional-artifact)
from bintray-release.
I just updated to version 0.3.5 and the custom publication discussed above seems to be broken now:
Caused by: org.gradle.api.internal.MissingMethodException: Could not find method publishing() for arguments [build_12cycqr9h1kaaswhvdttv9vva$_run_closure5_closure10@1f71e024] on root project
Should I open a new issue? Or perhaps I missed something in the update process?
from bintray-release.
hey @jcranky there's an issue already #75
the temporary solution is to just revert back to 0.3.4 until we fix and release a new one
from bintray-release.
Uhmmm not sure if this is the same thing. Using 0.3.4
gives me the same result:
Caused by: org.gradle.api.internal.MissingMethodException: Could not find method publishing() for arguments [build_hvucr0990rgadjc575ptdeb4m$_run_closure5_closure10@384472bf] on root project
Reverting to 0.3.2
works though.
from bintray-release.
Related Issues (20)
- Do you consider adding like 'archivesPath ' feature,to add progurad jar HOT 1
- I push my kotlin module to bintray and find it is empty when I test it. HOT 3
- Android databinding support..?
- The attempt to release the Android library ends up being successful even if bintray user/key are wrong HOT 2
- Do you consider adding like 'archivesPath ' feature,to add progurad jar/aar
- error for: 'com.android.tools.build:gradle:4.0.0' HOT 2
- Cause: org/gradle/api/internal/java/usagecontext/LazyConfigurationUsageContext HOT 11
- Q: how can i configure to enable only particular publications to maven local? HOT 6
- POM project file is not valid HOT 3
- Execution failed for task ':Csj:mockableAndroidJar'. > java.util.concurrent.ExecutionException: java.util.concurrent.ExecutionException: com.android.builder.utils.FileCache$FileCreatorException: java.lang.IllegalArgumentException
- publishReleasePublicationToMavenLocal ---- Failed HOT 1
- When to support gradle6.1.1 HOT 1
- Is this library abandoned? HOT 1
- When an Android Module is published, it references exceptions
- The new plugin bintray-publish supports Gradle 6.0+ and Android Gradle Plugin 4.0+ HOT 3
- When targetSdkVersion>=29 under app, click the selected photos and the application crashes with the error message as follows:
- When can update gradle support 6.0+ HOT 9
- unable to upload due to 401 unauthorized error HOT 1
- Task 'releaseAndroidJavadocs' not found in root project HOT 1
- Can it support to config and publish to GitHub packages? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bintray-release.