I've built the stk and run the tests... But I'm wondering what happens
when you want to use the generated jars outside of mvn?
I've got a simple example (see below) in Eclipse and I've added the 2
stk jars (core and mapping) that are required to make it build.
The problem is when I run it: I've got it to work by just adding lots of
random jars from my .m2 repository to the classpath. But I guess this
isn't the best approach - especially as there is often more than one
version of each dependency available.
Is there a better way to manage the dependencies at runtime? Is there a
mvn task to build a fuge-hibernate distributable that contains a
consistent set of required jars?
Any ideas gratefully accepted,
Mark.
Organization organization = ( Organization )
DatabaseObjectHelper.getOrCreate( "saveIdentifiable:Organization:" +
String.valueOf( Math.random() ), "saveIdentifiableWithPerformer",
"net.sourceforge.fuge.common.audit.Organization" );
organization.setName("Acme Corp.");
organization = ( Organization ) DatabaseObjectHelper.save(
"net.sourceforge.fuge.common.audit.Organization", organization, null );
assert ( organization.getId() != null ) : "organization must have a
database id.";
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Fuge-devel mailing list
Fuge-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fuge-devel
From: fuge-deve...@lists.sourceforge.net [mailto:fuge-deve...@lists.sourceforge.net] On Behalf Of Allyson Lister
Sent: 05 September 2008 12:40
To: fuge-...@lists.sourceforge.net
Subject: Re: [Fuge-devel] Hibernate-stk dependencies
I don't think my original message was very clear! I guess what I really asking is: if I want to write some stand-alone code to populate a FuGE database using the Hibernate STK, then how do I build my classpath? In this case I am running my code in Eclipse, outside of the FuGE STK project.I don't really want a run-time dependency on maven (i.e. mvn:java). I suppose I could build my project using maven (though I'm not keen on that because I don't really understand maven). Perhaps the easiest thing to do is add the lib directory from the SyMBA war to my classpath! That would ensure that I have the required jars (plus a few more).Another way of asking the same question is: is there a hibernate-sdk distributable? i.e. can maven build a zip containing the relevant jars?Mark.
From: fuge-deve...@lists.sourceforge.net [mailto:fuge-deve...@lists.sourceforge.net] On Behalf Of Allyson Lister
Sent: 05 September 2008 12:40
To: fuge-...@lists.sourceforge.net
Subject: Re: [Fuge-devel] Hibernate-stk dependencies
Hi Mark,
Ok - so, unless you're using maven, you'd have to build your classpath manually. That's why I suggested building your own project as a maven project - then just writing in your own pom.xml that you require one or more of the fuge-hibernate jars as a dependency would then pull down all of the other required dependencies automatically - that's the great benefit of maven: you don't have to worry about classpaths or anything. Then, once your own jar is made, that works perfectly well as a standalone jar, irrespective of how it was built.
Now, in theory, each fuge-hibernate jar contains within it all jars it needs to run. The only time you would need maven's dependency resolution as described above would be if there was some reason the fuge-hibernate jars needed updating (e.g. if you changed the database connection details in them).
I'm not sure what's going on with your example - I don't really do anything outside of maven these days, unless it's to copy a maven-built war to a tomcat server, for example. But I am sure that maven-built jars are just jars, and as such can be used in a standalone manner. I'll be switching over to my linux partition later today, and will be able to test out your piece of code.
The problem with a "distributable" is that each sub-project of a maven project has its own set of dependencies, and would therefore lead to its own distributable. Further, I don't think it would be too helpful of FuGE people to provide such things, as all of the database connection details are currently stored within the jars, so you'd have to unpack them to modify the properties file. I'm sure there's a way around this, but I am not really all that up on the usage of properties files. There must be a way of layering such files, such that a user-supplied one is used in preference to one in the jars. Perhaps someone on this mailing list that knows how to do this could help in this respect with an addition to the STK?
I'll get back to you later on your specific issue.
2008/9/8 Woodbridge, Mark R <m.wood...@imperial.ac.uk>
I don't think my original message was very clear! I guess what I really asking is: if I want to write some stand-alone code to populate a FuGE database using the Hibernate STK, then how do I build my classpath? In this case I am running my code in Eclipse, outside of the FuGE STK project.I don't really want a run-time dependency on maven (i.e. mvn:java). I suppose I could build my project using maven (though I'm not keen on that because I don't really understand maven). Perhaps the easiest thing to do is add the lib directory from the SyMBA war to my classpath! That would ensure that I have the required jars (plus a few more).Another way of asking the same question is: is there a hibernate-sdk distributable? i.e. can maven build a zip containing the relevant jars?Mark.
From: fuge-deve...@lists.sourceforge.net [mailto:fuge-deve...@lists.sourceforge.net] On Behalf Of Allyson Lister
Sent: 05 September 2008 12:40
To: fuge-...@lists.sourceforge.net
Subject: Re: [Fuge-devel] Hibernate-stk dependencies
Hi Allyson,
Now, in theory, each fuge-hibernate jar contains within it all jars it needs to run. The only time you would need maven's dependency resolution as described above would be if there was some reason the fuge-hibernate jars needed updating (e.g. if you changed the database connection details in them).
I don't think that is true... the fuge-hibernate jars only contain fuge classes. When you ask Maven to build a war it adds all the dependencies for you - I'm trying to do a similar thing in Eclipse.The code I sent you works fine... I just added dependencies to my classpath until it ran correctly. But to do it properly I'll look at using Maven in my project, or using the Maven Assembly Plugin in the FuGE Hibernate project.Thanks (again) for all your help. My question turned out to be more about Maven than FuGE!Mark.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Fuge-devel mailing list
Fuge-...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fuge-devel