I have eclipse java project. Gradle script:
apply plugin: 'java'
jar {
manifest {
attributes 'Title': 'xxx'
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'lib', include: '**/*.jar')
}
def myPackage = 'mypackage'
sourceSets {
main {
java.srcDirs = ['src']
}
}
Project file structure
src
com.company.core
....classes
com.company.impl
....classes
In jar file need file structure
com.company.core
...classes
com.mypackage.impl
...classes
Need to rename package company -> mypackge in jar file
It is not android.
Help please.
UPD
Thanks, Lance Java. It working for me.
But there was a problem. All classes from libs (google-play-services.jar, android.jar) come into jar... I need classes located only in src folder... I can to exclude classes by all packages, but i think it is no good solution...
Is there another way whith shadowJar?
My dependencies:
dependencies {
compile files('libs/android.jar')
compile files('libs/google-play-services.jar')
}
This can be done with the shadow plugin
See relocating packages
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With