Moving to multiproject result in path issues

View: New views
6 Messages — Rating Filter:   Alert me  

Moving to multiproject result in path issues

by Trond Andersen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a single WAR-project which builds without any problems. Creates a WAR file without any issues, but now I'm trying to move to a multiproject build because I have a separate jar file which is going to be included into the WAR file.

First issue I ran into was this:

 flatDir (name: 'localLibrary', dirs: 'library')

When I run the project with a multiproject build, this results in an error because now the project is no longer able to find the directory named library. I could fix this by adding the project name/directory into the flatDir, but I ran into other issues also.

My goal is that I would like to run gradle from within the project itself doing regular tasks such as unit tests etc, but at the same time I would like to be able to run from the parent project which packages everything together. This doesn't seem applicable with the way I've set up the multiproject build. Is this intended? If not - how can ensure that paths are working also in a multiproject build.

Here's my parent project build.gradle file:

dependsOnChildren()

subprojects {
    usePlugin 'java'
    group = 'mygroup'
    version = '0.1'
    sourceCompatibility = 1.6
    targetCompatibility = 1.6
    manifest.mainAttributes(
        'Implementation-Title': 'Project',
        'Implementation-Version': version,
        'Implementation-Vendor': 'ACME AS'
    )
}

project(':WebAppProj') {
    dependencies {
        compile project(':AppletProj')
    }
}

My settings.gradle:

include 'AppletProj', 'WebAppProj'


Any pointers on how to resolve this issue would be appreciated.


------- Trond

Re: Moving to multiproject result in path issues

by hdockter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Trond,

apologies for answering that late.

On Jun 22, 2009, at 1:42 PM, Trond Andersen wrote:

> I have a single WAR-project which builds without any problems.  
> Creates a WAR file without any issues, but now I'm trying to move to  
> a multiproject build because I have a separate jar file which is  
> going to be included into the WAR file.
>
> First issue I ran into was this:
>
>  flatDir (name: 'localLibrary', dirs: 'library')
>
> When I run the project with a multiproject build, this results in an  
> error because now the project is no longer able to find the  
> directory named library. I could fix this by adding the project name/
> directory into the flatDir, but I ran into other issues also.

I'm not sure were you declare this repository.

What you can do is to sue the rootDir or projectDir variable depending  
on your use case.

>
> My goal is that I would like to run gradle from within the project  
> itself doing regular tasks such as unit tests etc, but at the same  
> time I would like to be able to run from the parent project which  
> packages everything together. This doesn't seem applicable with the  
> way I've set up the multiproject build. Is this intended? If not -  
> how can ensure that paths are working also in a multiproject build.
>
> Here's my parent project build.gradle file:
>
> dependsOnChildren()
>
> subprojects {
>     usePlugin 'java'
>     group = 'mygroup'
>     version = '0.1'
>     sourceCompatibility = 1.6
>     targetCompatibility = 1.6
>     manifest.mainAttributes(
>         'Implementation-Title': 'Project',
>         'Implementation-Version': version,
>         'Implementation-Vendor': 'ACME AS'
>     )
> }
>
> project(':WebAppProj') {
>     dependencies {
>         compile project(':AppletProj')
>     }
> }
>
> My settings.gradle:
>
> include 'AppletProj', 'WebAppProj'
>
>
> Any pointers on how to resolve this issue would be appreciated.

What exactly does not work?

- Hans

--
Hans Dockter
Gradle Project Manager
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Writing Plugins

by Michael Fortin-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Hans, all,

I've been on the lookout for a grails plugin for some time but it's  
never materialized.  I might have some spare time to try my hand at  
writing one but I can't find any info in the documentation about how  
to write a plugin.  Where should I start if I wanted take a shot at it?

Thanks,
Mike

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Moving to multiproject result in path issues

by apolenur :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I ran into similar problem, and solve it in the following way
Keep in mind that I am very new to Gradle so not sure if what I am doing is a "right way".

 //in order to calculate dir location properly from children
    def lib = rootProject.getProjectDir().getCanonicalPath() +'/lib'

    repositories {
        flatDir name: 'localRepository', dirs: lib
    }

HTH, Alexi

Trond Andersen wrote:
I have a single WAR-project which builds without any problems. Creates a WAR
file without any issues, but now I'm trying to move to a multiproject build
because I have a separate jar file which is going to be included into the
WAR file.

First issue I ran into was this:

 flatDir (name: 'localLibrary', dirs: 'library')

When I run the project with a multiproject build, this results in an error
because now the project is no longer able to find the directory named
library. I could fix this by adding the project name/directory into the
flatDir, but I ran into other issues also.

My goal is that I would like to run gradle from within the project itself
doing regular tasks such as unit tests etc, but at the same time I would
like to be able to run from the parent project which packages everything
together. This doesn't seem applicable with the way I've set up the
multiproject build. Is this intended? If not - how can ensure that paths are
working also in a multiproject build.

Here's my parent project build.gradle file:

dependsOnChildren()

subprojects {
    usePlugin 'java'
    group = 'mygroup'
    version = '0.1'
    sourceCompatibility = 1.6
    targetCompatibility = 1.6
    manifest.mainAttributes(
        'Implementation-Title': 'Project',
        'Implementation-Version': version,
        'Implementation-Vendor': 'ACME AS'
    )
}

project(':WebAppProj') {
    dependencies {
        compile project(':AppletProj')
    }
}

My settings.gradle:

include 'AppletProj', 'WebAppProj'


Any pointers on how to resolve this issue would be appreciated.


------- Trond

Re: Moving to multiproject result in path issues

by Trond Andersen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>    def lib = rootProject.getProjectDir().getCanonicalPath() +'/lib'
I ended up doing the same thing in my project.

Maybe this should be a point in the user guide regarding multi project builds.

------- Trond

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Writing Plugins

by Adam Murdoch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Michael Fortin wrote:
> Hi Hans, all,
>
> I've been on the lookout for a grails plugin for some time but it's
> never materialized.  I might have some spare time to try my hand at
> writing one but I can't find any info in the documentation about how
> to write a plugin.  Where should I start if I wanted take a shot at it?
>

You need to:
1. implement the Plugin interface
2. make the implementation class available in your build script classpath.
3. usePlugin(PluginImplClass)

You have a couple of options for step 2:
- put the implementation in buildSrc/src/main/java or
buildSrc/src/main/groovy
- put the implementation in an external build which publishes the plugin
implementation class to a repository, and use a settings.gradle file to
add it to the build script classpath


Adam


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email