Skip to content

Instantly share code, notes, and snippets.

@BorePlusPlus
Created November 25, 2012 22:57
Show Gist options
  • Save BorePlusPlus/4145778 to your computer and use it in GitHub Desktop.
Save BorePlusPlus/4145778 to your computer and use it in GitHub Desktop.
Single ivy module multi project gradle build
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="org.bpp"
module="ivy-test"
revision="1.0"
status="integration"
publication="20121126212929"
/>
<configurations>
<conf name="archives" visibility="public" description="Configuration for archive artifacts."/>
<conf name="client" visibility="public"/>
<conf name="default" visibility="public" description="Configuration for default artifacts."/>
<conf name="server" visibility="public"/>
</configurations>
<publications>
<artifact name="ivy-test-client" type="jar" ext="jar" conf="archives,client"/>
<artifact name="ivy-test-core" type="jar" ext="jar" conf="client,server"/>
<artifact name="ivy-test-server" type="jar" ext="jar" conf="server"/>
</publications>
</ivy-module>
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="org.bpp"
module="ivy-test"
revision="1.0"
status="integration"
publication="20121125200638"/>
<configurations>
<conf name="client" visibility="public"/>
<conf name="server" visibility="public"/>
</configurations>
<publications>
<artifact name="ivy-test-client" type="jar" ext="jar" conf="client"/>
<artifact name="ivy-test-server" type="jar" ext="jar" conf="server"/>
<artifact name="ivy-test-core" type="jar" ext="jar" conf="client,server"/>
</publications>
<dependencies>
<dependency conf="client,server" org="com.google.guava" name="guava" rev="13.0.1"/>
<dependency conf="client" org="'org.antlr" name="stringtemplate" rev="4.0.2"/>
<dependency conf="server" org="com.google.code.gson" name="gson" rev="2.2.2"/>
</dependencies>
</ivy-module>
//ivy-test/build.gradle
apply plugin: 'base'
allprojects {
version = '1.0'
group = 'org.bpp'
}
subprojects {
apply plugin: 'java'
repositories {
mavenCentral()
}
}
configurations {
client
server
}
artifacts {
client file('client/build/libs/ivy-test-client-1.0.jar'), file('core/build/libs/ivy-test-core-1.0.jar') //':client:jar'
server file('server/build/libs/ivy-test-server-1.0.jar'), file('core/build/libs/ivy-test-core-1.0.jar') //':server:jar'
}
task upload {
dependsOn ':client:jar', 'uploadClient', ':server:jar', 'uploadServer'
}
tasks.withType(Upload) {
repositories {
ivy {
credentials {
username 'admin'
password 'password'
}
url 'http://server:8081/artifactory/simple/local-ivy'
}
}
}
//ivy-test/client/build.gradle
archivesBaseName = 'ivy-test-client'
dependencies {
compile project(':core'), 'org.antlr:stringtemplate:4.0.2'
}
//ivy-test/core/build.gradle
archivesBaseName = 'ivy-test-core'
dependencies {
compile 'com.google.guava:guava:13.0.1'
}
//ivy-test/server/build.gradle
archivesBaseName = 'ivy-test-server'
dependencies {
compile project(':core'), 'com.google.code.gson:gson:2.2.2'
}
//ivy-test/settings.gradle
include 'core', 'client', 'server'
ivy-test
+--- settings.gradle
+--- build.gradle
+--- core
| +--- src ...
| \--- build.gradle
+--- client
| +--- src ...
| \--- build.gradle
\--- server
+--- src ...
\--- build.gradle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment