Yes! The Trials examples are working now. It has never taken be so long to get something running.
If I look back, there was a whole lot of reasons why it didn’t work. But if you are about to get going with the Trails examples, do the following:
- Make sure you have Maven > 2.0.6 installed
- Make sure you have JDK 1.5.0 installed and that your JAVA_HOME points to something like: H:\java\sun\sdk\jdk\jre This means, to the Runtime environment inside the JDK inside the SDK.
Inside the Trails-Hibernate there is a maven pom.xml file that references %JAVA_HOME%\..\lib\tools.jar
So if your path is different, Maven will tell you that you should install tools.jar using:
mvn install:install-file -DgroupId=com.sun -DartifactId=tools -Dversion=1.5.0 -Dpackaging=jar -Dfile=tools.jar
If you do that, Maven will happily tell you it has installed everything - but you won’t find any com.sun folder inside your repository.
- check out the project on: http://svn.codehaus.org/trails/tags/trails-1.1
After that go to the command line and do a:
- mvn clean
- mvn clean install -e > log.txt (so you can look at the errors better later on)
- mvn eclipse:eclipse
Then import an “already-existing project” into Eclipse inside the examples folder, for instance the Roster example project.
Then go to the project and open the .classpath file and edit it and add the following lines near the end of the file:
<classpathentry kind=”var” path=”M2_REPO/org/trailsframework/trails-core/1.1/trails-core-1.1.jar”/>
<classpathentry kind=”var” path=”M2_REPO/org/trailsframework/trails-hibernate/1.1/trails-hibernate-1.1.jar”/>
<classpathentry kind=”var” path=”M2_REPO/org/trailsframework/trails-security/1.1/trails-security-1.1.jar”/>
Then close the eclipse project, go to the command line and do a mvn clean again, so that Maven will download the correctly compiled dependencies instead of compiling them wrong from the sources.
Then go back to Eclipse and open the project. If there is still some errors do a mvn install from inside Eclipse.
Remember: If you change the environment variables, close all command line windows as it will not activate the changes until the last command line window has been closed. Also restart Eclipse if you fiddle around with the environment variables.