Discussion:
Switch between jar and project dependency for eclipse?
Dave King
2011-02-22 17:30:24 UTC
Permalink
We have a number of common jars that are used across products. We
currently build and post those projects to our nexus repo and the
other builds see them as external dependencies. These projects are in
separate Git repositories.

This has become an issue for the developers of those projects who are
used to having one eclipse project where they can debug and edit.

Any ideas on how we could provide a property or properties that would
tell the eclipse task to generate project dependencies instead of jar
dependencies?

- Peace
Dave
Peter Niederwieser
2011-02-22 18:31:18 UTC
Permalink
Post by Dave King
Any ideas on how we could provide a property or properties that would
tell the eclipse task to generate project dependencies instead of jar
dependencies?
You could try to achieve this by manipulating
EclipseProject.referencedProjects and EclipseClasspath.minusConfigurations.
For WTP projects you'd also have to reconfigure the EclipseWtp task (which,
by the way, has been split into two for the upcoming 1.0-milestone-1). Other
options:

1. Use "git submodule" to create an aggregate Git project and aggregate
Gradle build. This is what the Qi4j project does (see
https://github.com/Qi4j/qi4j-sdk).
2. Post-process the Eclipse files generated by Gradle according to your
needs. The user guide explains how to do this.

--
Peter Niederwieser 
Developer, Gradle
http://www.gradle.org
Trainer & Consultant, Gradle Inc.
http://www.gradle.biz
Creator, Spock Framework
http://spockframework.org
--
View this message in context: http://gradle.1045684.n5.nabble.com/Switch-between-jar-and-project-dependency-for-eclipse-tp3395869p3395954.html
Sent from the gradle-user mailing list archive at Nabble.com.
Dave King
2011-02-23 00:09:51 UTC
Permalink
Thanks Peter. The hooks from the guide turned out to be the ticket.
Haven't done the full thing yet but seems very promising.

- Peace
Dave
Post by Peter Niederwieser
Post by Dave King
Any ideas on how we could provide a property or properties that would
tell the eclipse task to generate project dependencies instead of jar
dependencies?
You could try to achieve this by manipulating
EclipseProject.referencedProjects and EclipseClasspath.minusConfigurations.
For WTP projects you'd also have to reconfigure the EclipseWtp task (which,
by the way, has been split into two for the upcoming 1.0-milestone-1). Other
1. Use "git submodule" to create an aggregate Git project and aggregate
Gradle build. This is what the Qi4j project does (see
https://github.com/Qi4j/qi4j-sdk).
2. Post-process the Eclipse files generated by Gradle according to your
needs. The user guide explains how to do this.
--
Peter Niederwieser
Developer, Gradle
http://www.gradle.org
Trainer & Consultant, Gradle Inc.
http://www.gradle.biz
Creator, Spock Framework
http://spockframework.org
--
View this message in context: http://gradle.1045684.n5.nabble.com/Switch-between-jar-and-project-dependency-for-eclipse-tp3395869p3395954.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
   http://xircles.codehaus.org/manage_email
fbrubbo
2013-09-08 20:21:01 UTC
Permalink
Hi David,

Was you able to create a task (or anything else) which is capable to specify
dependencies between eclipse projects instead of going to the repository?

What I've done up until now is this.

configurations.all {
resolutionStrategy.eachDependency { details ->
def groupName = details.requested.group
def libName = details.requested.name;
// here we check if the requested dependency is developed by
ourselves
if ( groupName== 'br.com.<OUR_COMPANY>') {
// If so, we check in the current workspace if there is an
project with the appropriated name
project.file("../").list().each {projectName ->
if( projectName.equalsIgnoreCase(libName) ){
// If so, we change the dependency from jar to local
eclipse project
project.eclipse.classpath.file {
withXml { xml ->
def node = xml.asNode()

println "The project " + projectName + " was
found into the current workspace. Using it instead of the equivalent lib"
node.appendNode( 'classpathentry', [ kind:
'src', path: "/${projectName}", exported: 'true',
combineaccessrules:'false'])

def libNode = node.find
{it.-iJagdbcvFCKHVaP9xPh/***@public.gmane.org(libName)}
if(libNode != null) {
node.remove(libNode)
}
}
}
// Then we do not resolve the jar dependency
details.useTarget ''
}
}
}
}
}

This seems to work for 'java' projects with eclipse classpath container
'org.springsource.ide.eclipse.gradle.dsld.classpathcontainer' disabled (On
the other hand, this container adds back the jar dependecy). But for war
projects, we could not avoid resolving jar dependencies because whenever we
would like to build the war it must be inside WEB-INF/lib dir.

Moreover, it seems we have to update the file
'org.eclipse.wst.common.component' in a similar way we did with .classpath,
but we didn't found how to do it with current api.


any example/idea will be appreciated
Thanks
Fernando Rubbo



--
View this message in context: http://gradle.1045684.n5.nabble.com/Switch-between-jar-and-project-dependency-for-eclipse-tp3395869p5711824.html
Sent from the gradle-user mailing list archive at Nabble.com.

Loading...