Help with using classifiers

30 views
Skip to first unread message

Markus Joschko

unread,
Oct 31, 2011, 8:34:41 AM10/31/11
to simple-build-tool
I am an absolute beginner with sbt and struggle to convert a maven pom
dependency into a working sbt dependency description.

This is the instruction from the neo4j manual on how to add the
embedded server as a dependency with maven:

<dependencies>
<dependency>
<groupId>org.neo4j.app</groupId>
<artifactId>neo4j-server</artifactId>
<version>${neo4j-version}</version>
</dependency>
<dependency>
<groupId>org.neo4j.app</groupId>
<artifactId>neo4j-server</artifactId>
<classifier>static-web</classifier>
<version>${neo4j-version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>neo4j-release-repository</id>
<name>Neo4j Maven 2 release repository</name>
<url>http://m2.neo4j.org/releases</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

The neo4j-server is added once plain and once with a classifier static-
web. I tried to do the same in my build.sbt

libraryDependencies ++= Seq("org.neo4j.app" % "neo4j-server" % "1.5-
SNAPSHOT",
"org.neo4j.app" % "neo4j-
server" % "1.5-SNAPSHOT" classifier "static-
web")

resolvers ++= Seq("neo4j-public-repository" at "http://
m2.neo4j.org")

However if I declare it that way, I can't compile my code because the
dependency to the plain neo4j-server jar doesn't seem to be
fullfilled.
If I remove the entry with the static-web classifier, I can compile
fine but have problem at runtime as all the resources of that package
are not available.

For me it looks like I can only have one of both in sbt. Any help on
how I can include both? BTW, is there an easy way to get a runtime
classpath printed to the console?

Thanks,
Markus

Markus Joschko

unread,
Oct 31, 2011, 10:07:37 AM10/31/11
to simple-build-tool
In the meantime I found a stackoverflow question which shows a
solution in ivy to include the multi artifact module
http://stackoverflow.com/questions/7804253/how-to-dowload-multiple-maven-dependencies-in-ivy-with-different-classifiers

However I still don't get it in sbt to work. I tried it with ivyXML
but had no luck:

libraryDependencies ++= Seq("org.neo4j" % "neo4j-scala" % "0.1.0-
SNAPSHOT")

ivyXML := <dependency org="org.neo4j.app" name="neo4j-server" rev="1.5-
SNAPSHOT">
<artifact name="neo4j-server" type="jar" /
>
<artifact name="neo4j-server" type="jar"
m:classifier="static-web"/
>
</
dependency>

resolvers ++= Seq("neo4j-public-repository" at "http://m2.neo4j.org/
snapshots")

g-eorge

unread,
Nov 17, 2011, 6:30:07 AM11/17/11
to simple-build-tool
I'm having the same problem trying to get sbt and neo4j to work
together. Would be interested to know if anyone has any more ideas on
this.

thanks

On Oct 31, 2:07 pm, Markus Joschko <markus.josc...@gmail.com> wrote:
> In the meantime I found a stackoverflow question which shows a
> solution in ivy to include the multi artifact modulehttp://stackoverflow.com/questions/7804253/how-to-dowload-multiple-ma...

chris

unread,
Nov 18, 2011, 2:21:54 AM11/18/11
to simple-build-tool
Hi Markus,
to show the runtime classpath you can do the following:
show runtime:full-classpath

Of course this does only work if your build script compiles.

Cheers,
Christian
Reply all
Reply to author
Forward
0 new messages