Application Plugin Classpath Problem + General Tips

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Application Plugin Classpath Problem + General Tips

ivolo
This post has NOT been accepted by the mailing list yet.
Hi,

I am new to Gradle (am using 1.1), and have been having a bit of trouble starting off. Our project structure is not simple, but should be of no real problem to an experienced Gradle user. The main description is its a number of Storm topologies. Each storm topology is a fat jar which contains the app files, plus all the dependencies needed to run it. Each topology has to be built "with storm" and "without-storm" (without-storm meaning all the app code and dependencies but excluding the actual storm jar since it will be on the server's class path).

Our folder structure is like this:

/components/api/build.gradle
/components/models/build.gradle
/components/...

/storm/apilogger/build.gradle
/storm/poseidon/build.gradle
/storm/storm-utils/build.grade

/settings.gradle
/build.gradle

The outer settings.gradle encompasses all the projects, and the outer build.gradle just sets the java/eclipse plugin and sourceCompatibility for the subprojects.

Storm-utils project actually requires the storm jar from its maven repository, as well as provides some helpers we have for building storm topologies.

Each of these projects builds successfully. The weird thing is when I navigate to /storm/apilogger and try to "gradle run" it cant find a storm-utils class that is built and is in /storm/storm-utils/build/storm-utils-0.0.1.jar

I get a:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sio/utils/storm/runner/TopologyRunner
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:787)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:447)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)

When I print out the classpath inside the run task of the /storm/storm-utils/build.gradle:

I get these paths. Each of my build.gradle files defines a version number of '0.0.1', and I can see that reflected in each of the built jars (like /storm-utils/build/lib/storm-utils-0.0.1.jar).

The weird thing to notice is on the sixth line of the classpaths, it looks for

/home/ilya/dev/project/src/backend/storm/storm-utils/build/libs/storm-utils.jar

instead of

/home/ilya/dev/project/src/backend/storm/storm-utils/build/libs/storm-utils-0.0.1.jar

but it properly gets all the other projects. I can't for the life of me figure out why.

If anyone has any ideas, I would really appreciate the help. I am also looking for general feedback on how to better use gradle.

Thanks very much,

Ilya