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 via email to