Gradle-grails-plugin-2.0.0-snapshot : jar file empty


(smurfs.doll) #1

Hi

I am working on a multi module grails project and using gradle-grails-plugin-2.0.0-snapshot Main project [A] . it depends on grails plugin [b] and [c]

When I try to do a gradle build or gradle assemble, it creates the build folder in [A] and [b] and [C] and puts a jar file. If i open the jar file, it is empty. Can you please help me on how to resolve this/

Thanks Smurfs


(Luke Daley) #2

I’ll need more detail. If you can share your buildscripts it would be helpful.


(smurfs.doll) #3

Hi Luke,

I have resolved that issue. But, I have got one more issue:

Consider a Multi module Project :

MainProject which has build.gradle and settings

–> finance is just a folder which has two grails project

–> domain --> grails project which has build.gradle

–> core --> grails project which has build.gradle

In the settings, i have the following code:

include ‘:finance:domain’, ‘:finance:core’

In the subprojects of build.gradle of MainProject, i tried to add the following code:

“grails-package-plugin” {

if (project.hasProperty(“args”)) {

args = “–binary”

} } uploadArchives {

repositories.mavenDeployer {

repository(url: “http://localhost:8085/nexus/content/repositories/test/xms”) {

authentication(userName: “admin”, password: “admin123”)

} } }

it is throwing error as it cannot find finance.jar, but I do not need a jar for that folder. Also, i cannot add “grails-package-plugin” in the main project.

Can you please help me on that.

Thanks Smurf


(Luke Daley) #4

what are you wanting to happen? Do you just want to publish the war file? Or do you want to publish the plugin jars?


(smurfs.doll) #5

I want to publish the jars[core and domain that are under finance folder] and wars to nexus through jenkins.

MainProject which has build.gradle and settings

–> finance is just a folder which has the following two grails plugin project

–> domain --> grails plugin project which has build.gradle

–> core --> grails plugin project which has build.gradle -->App -->grails project that is dependant on finance/domain and finance/core and create a war.

Smurf


(Luke Daley) #6

It sounds like you are applying the java plugin to the grails plugin projects, is this right?


(smurfs.doll) #7

the app.war will have dependant jars to core.jar and domain.jar.

If i create the project structure asbelow, then it works fine.

MainProject

->domain

->core

->App

I i create few plugins under a folder as below and put some generic tasks in the mainprojects build.gradle, i think, it tries to apply that to each and every project underneath and that causes issue.

MainProject

->domain

->finance/core

->finance/App

“grails-package-plugin” {

if (project.hasProperty(“args”)) {

args = “–binary”

}

}

uploadArchives {

repositories.mavenDeployer {

repository(url: “http://localhost:8085/nexus/content/r…”) {

authentication(userName: “admin”, password: “admin123”)

}

}

} Can you please clarify.


(Luke Daley) #8

It’s impossible to say based on the information given.

What’s your complete top level build.gradle. Please share it via GitHub Gist.


(smurfs.doll) #9

Build.gradle ========== allprojects {

apply plugin: ‘java’

apply plugin: ‘maven’

apply plugin: ‘base’ }

subprojects {

repositories {

mavenCentral()

}

dependencies {

compile “javax.servlet:servlet-api:2.5”

}

task install1(type: Upload){

configuration = configurations.archives

repositories{

mavenInstaller()

} }

uploadArchives {

repositories.mavenDeployer {

repository(url: “http://localhost:8085/nexus/content/repositories/test”) {

authentication(userName: “admin”, password: “admin123”)

} } }

“grails-package-plugin” {

if (project.hasProperty(“args”)) {

args = “–binary”

} } }

settings.xml ========== include ‘:finance:domain’, ‘:finance:core’ , ‘:app’