Code Monkey home page Code Monkey logo

Comments (7)

mstachniuk avatar mstachniuk commented on June 10, 2024

After a quick check, my suggestion is to create a separate submodule in your project called some-library-fat, include as compile/implementation scope the :some-library and define a jar like this:

dependencies {
    compile project(":some-library")
}

jar {
    manifest {
        attributes 'Main-Class': 'my.main.Class'
    }
    from {
        configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    }
}

from shipkit.

magx2 avatar magx2 commented on June 10, 2024

Marcin thanks for help. I will definitely try your solution.

On the other hand I'm wondering if I can publish multiple artifacts with ship. Take a look on my configuration:

build.gradle https://github.com/magx2/jSuplaApi/blob/master/build.gradle#L71

publishing {
	publications {
		JarPublication(MavenPublication) {
			from components.java
			groupId group
			artifact jar
			artifactId project.name
			version project.version
		}
		FatJarPublication(MavenPublication) {
			from components.java
			groupId group
			artifact fatJar
			artifactId project.name + '-fat'
			version project.version
		}
	}
}

shipkit.gradle https://github.com/magx2/jSuplaApi/blob/master/gradle/shipkit.gradle#L16

allprojects {
	plugins.withId("org.shipkit.bintray") {
		bintray {
			publications = ['JarPublication', 'FatJarPublication']
			println publications
			key = System.getenv("BINTRAY_API_KEY")
			pkg {
				repo = "bigboy"
				user = "magx2"
				userOrg = "big-boy"
				name = 'jSuplaApi'
				licenses = ['MIT']
				labels = ['Supla', "IoT"]
			}
		}
	}
}

Don't you think this should work?

from shipkit.

mstachniuk avatar mstachniuk commented on June 10, 2024

It doesn't work :-( (I checked your build and publication history). But the trick with submodule work!
The reason for that might be that Shipkit internally defines publications (including -source & -javadoc artifacts, pom customization, etc.) what is / might be in conflict with your settings.
IMHO one module per publication is a cleaner solution.

from shipkit.

magx2 avatar magx2 commented on June 10, 2024

IMHO opinion it would be nice that shipkit recognizes and uses different publications but it might be discussion for another time.

For those who has similar problem I paste my solution:

  1. Create folder that has same as sub-module
  2. Create build.gradle with content
plugins {
	id 'java'
}

group = 'xxx.yyy.zzz'

dependencies {
	implementation rootProject
}


jar {
	from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
  1. Add new module to settings.gradle

You can find full change set here magx2/jSuplaApi@8a6e0ba

from shipkit.

geoHeil avatar geoHeil commented on June 10, 2024

I am also interested in this feature but do not want to create a separate submodule. Instead, I want to apply the shadow plugin https://github.com/johnrengelman/shadow

However, so far I did not manage to get the shadow stuff to publish.

from shipkit.

geoHeil avatar geoHeil commented on June 10, 2024

https://gist.github.com/s1monw1/9bb3d817f31e22462ebdd1a567d8e78a#file-bintray-build-gradle-kts-L66 is working in a non multi-project build using the kotlin-DSL:


publishing {
    publications.invoke {
        publicationName(MavenPublication::class) {
            artifactId = artifactID
            artifact(shadowJar)
            pom.addDependencies()
        }
    }
}

However, I do not get this to compile in my own project. This fails for me with:

e: /Users/geoheil/development/projects/streaming-reference/build.gradle.kts:80:13: Unresolved reference: publicationName
e: /Users/geoheil/development/projects/streaming-reference/build.gradle.kts:81:17: Unresolved reference: artifactId
e: /Users/geoheil/development/projects/streaming-reference/build.gradle.kts:82:17: Unresolved reference: artifact
e: /Users/geoheil/development/projects/streaming-reference/build.gradle.kts:83:17: Unresolved reference: pom

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/geoheil/development/projects/streaming-reference/build.gradle.kts' line: 80

* What went wrong:
Script compilation errors:

  Line 80:             publicationName(MavenPublication::class) {
                       ^ Unresolved reference: publicationName

  Line 81:                 artifactId = project.name
                           ^ Unresolved reference: artifactId

  Line 82:                 artifact(shadowJar)
                           ^ Unresolved reference: artifact

  Line 83:                 pom.addDependencies()
                           ^ Unresolved reference: pom

4 errors


from shipkit.

mockitoguy avatar mockitoguy commented on June 10, 2024

@geoHeil, I recommend using following plugins (instead of the current Shipkit plugin):

The new plugins are small and allow you to fully control the publications. The new plugins reflect our future direction for Shipkit Gradle plugins (https://github.com/mockito/shipkit/blob/master/docs/design-specs/future-shipkit.md).

from shipkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.