Issue with Velocity 1.5 dep and Gradle 0.1.4

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with Velocity 1.5 dep and Gradle 0.1.4

pbarnes
Hi,

I seem to be having an issue with specifying dependencies correctly.  I created a sample project to test what I'm doing wrong:

test\
test\gradlefile
test\src\
test\src\CustomVelocityEngine.java

My gradlefile is as follows:

usePlugin('java')

sourceCompatibility = 1.5
targetCompatibility = 1.5

srcDirNames = ["/"]

dependencies {
    addMavenRepo()
    compile "org.apache.velocity:velocity:1.5"
}


My CustomVelocityEngine.java is just a blank file for test purposes:

public class CustomVelocityEngine extends org.apache.velocity.app.VelocityEngine {
  // just a compile test
}


When I run:  

gradle compile

I get a compilation error as follows:

Executing: :compile
:: resolving dependencies :: unspecified#test;unspecified
        confs: [compile]
        found org.apache.velocity#velocity;1.5 in MavenRepo
downloading http://repo1.maven.org/maven2/org/apache/velocity/velocity/1.5/velocity-1.5.pom ...
        [SUCCESSFUL ] org.apache.velocity#velocity;1.5!velocity.pom (76ms)
    [javac] Compiling 1 source file to /Users/pbarnes/code/java/projects/test/build/classes
/Users/pbarnes/code/java/projects/test/src/CustomVelocityEngine.java:1: package org.apache.velocity.app does not exist
public class CustomVelocityEngine extends org.apache.velocity.app.VelocityEngine {
                                                                 ^
1 error


So I thought the issue was in downloading the dependency.  I reran gradle with the -d option and noticed this line looked odd, like it actually added the 'POM' file to the classpath instead of jar files:

11:06:13.722 [main] DEBUG o.gradle.api.tasks.compile.AntJavac - Add /Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/poms/velocity-1.5.pom to Ant classpath!
Adding reference: compile.classpath

I'm not an expert with Ivy, but I guess I would have expected Ivy to download the dependencies (which look correct in '/Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/ivy-1.5.xml') and added those jars to the classpath.

I'm guessing I've misconfigured something?

Thanks in advance,

Phil..
Reply | Threaded
Open this post in threaded view
|

Re: Issue with Velocity 1.5 dep and Gradle 0.1.4

pbarnes
...and of course, 5 minutes after I post, I think I see the issue.  In the file '/Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/ivy-1.5.xml', the lines:

<publications>
      <artifact name="velocity" type="pom" ext="pom" conf="master"/>
</publications>

If I understand Ivy correctly, this is the only artifact that would get generated, so no JAR file is defined?  And since I assume ivy-1.5.xml is created from the .pom file, is it an issue with the .pom?

And if all of this is correct, this is one of those special cases that I need to define my own dependency (or repository)? ;)

Thanks again.

Phil..

pbarnes wrote
Hi,

I seem to be having an issue with specifying dependencies correctly.  I created a sample project to test what I'm doing wrong:

test\
test\gradlefile
test\src\
test\src\CustomVelocityEngine.java

My gradlefile is as follows:

usePlugin('java')

sourceCompatibility = 1.5
targetCompatibility = 1.5

srcDirNames = ["/"]

dependencies {
    addMavenRepo()
    compile "org.apache.velocity:velocity:1.5"
}


My CustomVelocityEngine.java is just a blank file for test purposes:

public class CustomVelocityEngine extends org.apache.velocity.app.VelocityEngine {
  // just a compile test
}


When I run:  

gradle compile

I get a compilation error as follows:

Executing: :compile
:: resolving dependencies :: unspecified#test;unspecified
        confs: [compile]
        found org.apache.velocity#velocity;1.5 in MavenRepo
downloading http://repo1.maven.org/maven2/org/apache/velocity/velocity/1.5/velocity-1.5.pom ...
        [SUCCESSFUL ] org.apache.velocity#velocity;1.5!velocity.pom (76ms)
    [javac] Compiling 1 source file to /Users/pbarnes/code/java/projects/test/build/classes
/Users/pbarnes/code/java/projects/test/src/CustomVelocityEngine.java:1: package org.apache.velocity.app does not exist
public class CustomVelocityEngine extends org.apache.velocity.app.VelocityEngine {
                                                                 ^
1 error


So I thought the issue was in downloading the dependency.  I reran gradle with the -d option and noticed this line looked odd, like it actually added the 'POM' file to the classpath instead of jar files:

11:06:13.722 [main] DEBUG o.gradle.api.tasks.compile.AntJavac - Add /Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/poms/velocity-1.5.pom to Ant classpath!
Adding reference: compile.classpath

I'm not an expert with Ivy, but I guess I would have expected Ivy to download the dependencies (which look correct in '/Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/ivy-1.5.xml') and added those jars to the classpath.

I'm guessing I've misconfigured something?

Thanks in advance,

Phil..
Reply | Threaded
Open this post in threaded view
|

Re: Issue with Velocity 1.5 dep and Gradle 0.1.4

hans_d
Administrator
Hi Phil,

On May 7, 2008, at 5:29 PM, pbarnes wrote:

...and of course, 5 minutes after I post, I think I see the issue.  In the
file '/Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/ivy-1.5.xml',
the lines:

<publications>
      <artifact name="velocity" type="pom" ext="pom" conf="master"/>
</publications>

If I understand Ivy correctly, this is the only artifact that would get
generated, so no JAR file is defined?  And since I assume ivy-1.5.xml is
created from the .pom file, is it an issue with the .pom?

And if all of this is correct, this is one of those special cases that I
need to define my own dependency (or repository)? ;)

The velocity pom in the maven repository is faulty. It sets its packaging to pom instead of jar.


To deal with this kind of problems you either have put a corrected pom in your own Maven repository (that's the way you HAVE to do it when using Maven).

Or you might use Gradle's client modules, where you can express transitive dependencies without relying on a pom.

dependencies {
    clientModule(['compile'], "org.apache.velocity:velocity:1.5") {
       dependencies("commons-collection:commons-collections:3.1", "commons-lang:commons-lang:2.1", "oro:oro:2.0.8")
   }
}

- Hans


Thanks again.

Phil..


pbarnes wrote:

Hi,

I seem to be having an issue with specifying dependencies correctly.  I
created a sample project to test what I'm doing wrong:

test\
test\gradlefile
test\src\
test\src\CustomVelocityEngine.java

My gradlefile is as follows:

usePlugin('java')

sourceCompatibility = 1.5
targetCompatibility = 1.5

srcDirNames = ["/"]

dependencies {
    addMavenRepo() 
    compile "org.apache.velocity:velocity:1.5"
}


My CustomVelocityEngine.java is just a blank file for test purposes:

public class CustomVelocityEngine extends
org.apache.velocity.app.VelocityEngine {
  // just a compile test
}


When I run:  

gradle compile

I get a compilation error as follows:

Executing: :compile
:: resolving dependencies :: unspecified#test;unspecified
confs: [compile]
found org.apache.velocity#velocity;1.5 in MavenRepo
downloading
...
[SUCCESSFUL ] org.apache.velocity#velocity;1.5!velocity.pom (76ms)
    [javac] Compiling 1 source file to
/Users/pbarnes/code/java/projects/test/build/classes
/Users/pbarnes/code/java/projects/test/src/CustomVelocityEngine.java:1:
package org.apache.velocity.app does not exist
public class CustomVelocityEngine extends
org.apache.velocity.app.VelocityEngine {
                                                                 ^
1 error


So I thought the issue was in downloading the dependency.  I reran gradle
with the -d option and noticed this line looked odd, like it actually
added the 'POM' file to the classpath instead of jar files:

11:06:13.722 [main] DEBUG o.gradle.api.tasks.compile.AntJavac - Add
/Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/poms/velocity-1.5.pom
to Ant classpath!
Adding reference: compile.classpath

I'm not an expert with Ivy, but I guess I would have expected Ivy to
download the dependencies (which look correct in
'/Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/ivy-1.5.xml') and
added those jars to the classpath.

I'm guessing I've misconfigured something?

Thanks in advance,

Phil..


-- 
Sent from the gradle-user mailing list archive at Nabble.com.


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




--
Hans Dockter
Gradle Project lead




Reply | Threaded
Open this post in threaded view
|

Re: Issue with Velocity 1.5 dep and Gradle 0.1.4

pbarnes
Thanks Hans - I specified a reference to a local copy using a FileSystemResolver and it worked fine.

I have a related question about dependencies, and I'm probably going to show my ignorance with Ivy here, but here goes.  ;)

I'm trying to create a 'multi-project' web application with dependencies on a 'core' custom library that is basically driven by Spring and Hibernate.  I can specify my dependencies fine for compile time, and the project compiles fine.  However, when I try to run "gradle dists" I run into issues with what I assume are "runtime dependencies" from my "compile dependencies" as I see non-optional Hibernate dependencies are pulled down (i.e. ehcache, asm-attrs, etc.).  But for Sun jars, such as 'jta.jar' these aren't available in the Maven repository (I assume due to license).  However, the Hibernate POM describes this dependency as required and therefore I assume Ivy tries to retrieve it, fails, and the build terminates.

Is my only recourse here to create my own clientModule with the correct dependencies or is there some way I can 'override' where this one dependency is looked up?  It doesn't seem to follow any of the classpathResolvers.add() that I specified, and always (only) looks to the Maven rep.

Thanks in advance,

Phil..


hdockter wrote
Hi Phil,

On May 7, 2008, at 5:29 PM, pbarnes wrote:

>
> ...and of course, 5 minutes after I post, I think I see the issue.  
> In the
> file '/Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/
> ivy-1.5.xml',
> the lines:
>
> <publications>
>       <artifact name="velocity" type="pom" ext="pom" conf="master"/>
> </publications>
>
> If I understand Ivy correctly, this is the only artifact that would  
> get
> generated, so no JAR file is defined?  And since I assume  
> ivy-1.5.xml is
> created from the .pom file, is it an issue with the .pom?
>
> And if all of this is correct, this is one of those special cases  
> that I
> need to define my own dependency (or repository)? ;)

The velocity pom in the maven repository is faulty. It sets its  
packaging to pom instead of jar.

See: https://issues.apache.org/jira/browse/VELOCITY-526

To deal with this kind of problems you either have put a corrected  
pom in your own Maven repository (that's the way you HAVE to do it  
when using Maven).

Or you might use Gradle's client modules, where you can express  
transitive dependencies without relying on a pom.

dependencies {
     clientModule(['compile'], "org.apache.velocity:velocity:1.5") {
        dependencies("commons-collection:commons-collections:3.1",  
"commons-lang:commons-lang:2.1", "oro:oro:2.0.8")
    }
}

- Hans

>
> Thanks again.
>
> Phil..
>
>
> pbarnes wrote:
>>
>> Hi,
>>
>> I seem to be having an issue with specifying dependencies  
>> correctly.  I
>> created a sample project to test what I'm doing wrong:
>>
>> test\
>> test\gradlefile
>> test\src\
>> test\src\CustomVelocityEngine.java
>>
>> My gradlefile is as follows:
>>
>> usePlugin('java')
>>
>> sourceCompatibility = 1.5
>> targetCompatibility = 1.5
>>
>> srcDirNames = ["/"]
>>
>> dependencies {
>>     addMavenRepo()
>>     compile "org.apache.velocity:velocity:1.5"
>> }
>>
>>
>> My CustomVelocityEngine.java is just a blank file for test purposes:
>>
>> public class CustomVelocityEngine extends
>> org.apache.velocity.app.VelocityEngine {
>>   // just a compile test
>> }
>>
>>
>> When I run:
>>
>> gradle compile
>>
>> I get a compilation error as follows:
>>
>> Executing: :compile
>> :: resolving dependencies :: unspecified#test;unspecified
>> confs: [compile]
>> found org.apache.velocity#velocity;1.5 in MavenRepo
>> downloading
>> http://repo1.maven.org/maven2/org/apache/velocity/velocity/1.5/ 
>> velocity-1.5.pom
>> ...
>> [SUCCESSFUL ] org.apache.velocity#velocity;1.5!velocity.pom (76ms)
>>     [javac] Compiling 1 source file to
>> /Users/pbarnes/code/java/projects/test/build/classes
>> /Users/pbarnes/code/java/projects/test/src/
>> CustomVelocityEngine.java:1:
>> package org.apache.velocity.app does not exist
>> public class CustomVelocityEngine extends
>> org.apache.velocity.app.VelocityEngine {
>>                                                                  ^
>> 1 error
>>
>>
>> So I thought the issue was in downloading the dependency.  I reran  
>> gradle
>> with the -d option and noticed this line looked odd, like it actually
>> added the 'POM' file to the classpath instead of jar files:
>>
>> 11:06:13.722 [main] DEBUG o.gradle.api.tasks.compile.AntJavac - Add
>> /Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/poms/
>> velocity-1.5.pom
>> to Ant classpath!
>> Adding reference: compile.classpath
>>
>> I'm not an expert with Ivy, but I guess I would have expected Ivy to
>> download the dependencies (which look correct in
>> '/Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/
>> ivy-1.5.xml') and
>> added those jars to the classpath.
>>
>> I'm guessing I've misconfigured something?
>>
>> Thanks in advance,
>>
>> Phil..
>>
>
> --
> View this message in context: http://www.nabble.com/Issue-with- 
> Velocity-1.5-dep-and-Gradle-0.1.4-tp17106235p17106415.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

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



Reply | Threaded
Open this post in threaded view
|

Re: Issue with Velocity 1.5 dep and Gradle 0.1.4

pbarnes
Re-reading this, I realized I hi-jacked my own thread with a different topic, so I'll repost for clarity.  Sorry about that.

pbarnes wrote
Thanks Hans - I specified a reference to a local copy using a FileSystemResolver and it worked fine.

I have a related question about dependencies, and I'm probably going to show my ignorance with Ivy here, but here goes.  ;)

I'm trying to create a 'multi-project' web application with dependencies on a 'core' custom library that is basically driven by Spring and Hibernate.  I can specify my dependencies fine for compile time, and the project compiles fine.  However, when I try to run "gradle dists" I run into issues with what I assume are "runtime dependencies" from my "compile dependencies" as I see non-optional Hibernate dependencies are pulled down (i.e. ehcache, asm-attrs, etc.).  But for Sun jars, such as 'jta.jar' these aren't available in the Maven repository (I assume due to license).  However, the Hibernate POM describes this dependency as required and therefore I assume Ivy tries to retrieve it, fails, and the build terminates.

Is my only recourse here to create my own clientModule with the correct dependencies or is there some way I can 'override' where this one dependency is looked up?  It doesn't seem to follow any of the classpathResolvers.add() that I specified, and always (only) looks to the Maven rep.

Thanks in advance,

Phil..


hdockter wrote
Hi Phil,

On May 7, 2008, at 5:29 PM, pbarnes wrote:

>
> ...and of course, 5 minutes after I post, I think I see the issue.  
> In the
> file '/Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/
> ivy-1.5.xml',
> the lines:
>
> <publications>
>       <artifact name="velocity" type="pom" ext="pom" conf="master"/>
> </publications>
>
> If I understand Ivy correctly, this is the only artifact that would  
> get
> generated, so no JAR file is defined?  And since I assume  
> ivy-1.5.xml is
> created from the .pom file, is it an issue with the .pom?
>
> And if all of this is correct, this is one of those special cases  
> that I
> need to define my own dependency (or repository)? ;)

The velocity pom in the maven repository is faulty. It sets its  
packaging to pom instead of jar.

See: https://issues.apache.org/jira/browse/VELOCITY-526

To deal with this kind of problems you either have put a corrected  
pom in your own Maven repository (that's the way you HAVE to do it  
when using Maven).

Or you might use Gradle's client modules, where you can express  
transitive dependencies without relying on a pom.

dependencies {
     clientModule(['compile'], "org.apache.velocity:velocity:1.5") {
        dependencies("commons-collection:commons-collections:3.1",  
"commons-lang:commons-lang:2.1", "oro:oro:2.0.8")
    }
}

- Hans

>
> Thanks again.
>
> Phil..
>
>
> pbarnes wrote:
>>
>> Hi,
>>
>> I seem to be having an issue with specifying dependencies  
>> correctly.  I
>> created a sample project to test what I'm doing wrong:
>>
>> test\
>> test\gradlefile
>> test\src\
>> test\src\CustomVelocityEngine.java
>>
>> My gradlefile is as follows:
>>
>> usePlugin('java')
>>
>> sourceCompatibility = 1.5
>> targetCompatibility = 1.5
>>
>> srcDirNames = ["/"]
>>
>> dependencies {
>>     addMavenRepo()
>>     compile "org.apache.velocity:velocity:1.5"
>> }
>>
>>
>> My CustomVelocityEngine.java is just a blank file for test purposes:
>>
>> public class CustomVelocityEngine extends
>> org.apache.velocity.app.VelocityEngine {
>>   // just a compile test
>> }
>>
>>
>> When I run:
>>
>> gradle compile
>>
>> I get a compilation error as follows:
>>
>> Executing: :compile
>> :: resolving dependencies :: unspecified#test;unspecified
>> confs: [compile]
>> found org.apache.velocity#velocity;1.5 in MavenRepo
>> downloading
>> http://repo1.maven.org/maven2/org/apache/velocity/velocity/1.5/ 
>> velocity-1.5.pom
>> ...
>> [SUCCESSFUL ] org.apache.velocity#velocity;1.5!velocity.pom (76ms)
>>     [javac] Compiling 1 source file to
>> /Users/pbarnes/code/java/projects/test/build/classes
>> /Users/pbarnes/code/java/projects/test/src/
>> CustomVelocityEngine.java:1:
>> package org.apache.velocity.app does not exist
>> public class CustomVelocityEngine extends
>> org.apache.velocity.app.VelocityEngine {
>>                                                                  ^
>> 1 error
>>
>>
>> So I thought the issue was in downloading the dependency.  I reran  
>> gradle
>> with the -d option and noticed this line looked odd, like it actually
>> added the 'POM' file to the classpath instead of jar files:
>>
>> 11:06:13.722 [main] DEBUG o.gradle.api.tasks.compile.AntJavac - Add
>> /Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/poms/
>> velocity-1.5.pom
>> to Ant classpath!
>> Adding reference: compile.classpath
>>
>> I'm not an expert with Ivy, but I guess I would have expected Ivy to
>> download the dependencies (which look correct in
>> '/Users/pbarnes/.ivy2/cache/org.apache.velocity/velocity/
>> ivy-1.5.xml') and
>> added those jars to the classpath.
>>
>> I'm guessing I've misconfigured something?
>>
>> Thanks in advance,
>>
>> Phil..
>>
>
> --
> View this message in context: http://www.nabble.com/Issue-with- 
> Velocity-1.5-dep-and-Gradle-0.1.4-tp17106235p17106415.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

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