Archive for the ‘Maven’ Category

Trails examples finally working!!!! After 3 days !!!!

Monday, October 15th, 2007

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.

Upgrading Maven to 2.07

Saturday, October 13th, 2007

I was just using the command mvn clean install for the first time, and I got the error message that I need Maven 2.0.6….I was still using Maven 2.0.1 So now I have downloaded Maven 2.0.7 (hopefully it doesn’t matter to have a newer and hopefully even better version), changed my classpaths, closed all DOS windows and trying again to successfully get the Trails samples to work. This time I have also checked out Trails 1.1 instead of 1.1.1 - as 1.1 is the real 1.1.1 version or something confusing….

Ok, Maven has now finished its job - but: still the same problem :-( :

Project ID: com.javaforge.tapestry:tapestry-spring:jar:1.0.0

Reason: Cannot find parent: com.javaforge.tapestry:tapestry-javaforge for projec
t: com.javaforge.tapestry:tapestry-spring:jar:1.0.0 for project com.javaforge.ta
pestry:tapestry-spring:jar:1.0.0

Cannot find parent again!!!!!!!!!!!!!!!!!!!!!! AAAAAAAAAAAAAAAAAAARRRRRRGH

Maven wants to access:

\home\me\.m2\repository\com\javaforg
e\tapestry\tapestry-javaforge\1.0.0-SNAPSHOT\maven-metadata-http:\repo1.maven.or
g\maven2\.xml

but the operating system Windows XP says “no”….. :-(

The solution

I had dodgy SnapShot servers in the Maven settings.xml files

com.erinors.tapestry:tapdoc-project

Saturday, October 13th, 2007

Just trying to build Trials 1.1.1. Of course, Maven has not completed its job:

Project ID: com.erinors.tapestry:tapdoc-maven-plugin:maven-plugin:0.7.0-20070512.100908-1

Reason: Cannot find parent: com.erinors.tapestry:tapdoc-project for project: com.erinors.tapestry:tapdoc-maven-plugin:maven-plugin:0.7.0-20070512.100908-1

Does Maven do more harm then good ?

Saturday, October 13th, 2007

In theory, Maven is great. In practice you spend an awful lot of time on:

  • learning how to use it
  • learning how to deal with weird errors
  • waiting for it to finish its job

And now, add together all the time from all those Java developers all over the world.

Isn’t that a lot of time being basically wasted ?

Update 

Ok, once you are through with the learning Curve and once you have setup a local repository, things become a lot easier.

The other day I had to compile and “old” Ant based project - and I must admit Maven is more comfortable to use, once your POM.XML files are setup property:

But still: If your Maven project is working properly, this does not mean that it will never make any problems anymore - suddenly it stops working  and classes are not recognized anymore…and you have to clean your whole repository and build everything again from scratch. So it is a BIT unreliable in my opinion…and Eclipse does not like Maven very much and is playing up all the time (so I always use the command line interface instead).

Why does Maven overwrite itself all the time?

Saturday, October 13th, 2007

Maven is weird. Every time you launch a Maven target, it keeps on downloading the same stuff all over again - without remembering what is has already in its Repository.

Solution

…the SnapShot Servers!

Maven error: Cannot find parent

Friday, October 12th, 2007

I hate Maven! I keep on getting:

Project ID: com.javaforge.tapestry:tapestry-spring:jar:1.0.0

Reason: Cannot find parent: com.javaforge.tapestry:tapestry-javaforge for projec
t: com.javaforge.tapestry:tapestry-spring:jar:1.0.0

…although both tapestry-spring and tapestry-javaforge are inside the repository :-(

With maven -e I saw this weird path:

 Caused by: java.io.FileNotFoundException: \home\me\.m2\repository\com\javaforg
e\tapestry\tapestry-javaforge\1.0.0-SNAPSHOT\maven-metadata-http:\repo1.maven.or
g\maven2\.xml (Die Syntax f³r den Dateinamen, Verzeichnisnamen oder die Datentrõ
gerbezeichnung ist falsch)

org.apache.maven.plugins:maven-idea-plugin:maven-plugin:2.0

Friday, October 12th, 2007

Maven is such a pain and a timekiller once in a while. This time, I have downloaded the trials examples from svn and wanted to compile the Roster demo. However, Maven is refusing to download it……and manual installation didn’t help either.

[INFO] Scanning for projects…
[INFO] Searching repository for plugin with prefix: ‘idea’.
Downloading: http://webobjects.mdimension.com/maven2/releases/org/apache/maven/p
lugins/maven-idea-plugin/2.0/maven-idea-plugin-2.0.jar
[WARNING] Unable to get resource from repository tapestry-snapshots (http://peop
le.apache.org/~hlship/tapestry-snapshot-repository/)
Downloading: http://repository.codehaus.org//org/apache/maven/plugins/maven-idea
-plugin/2.0/maven-idea-plugin-2.0.jar
[WARNING] Unable to get resource from repository codehaus (http://repository.cod
ehaus.org/)
Downloading: http://www.ibiblio.org/maven2/org/apache/maven/plugins/maven-idea-p
lugin/2.0/maven-idea-plugin-2.0.jar
[INFO] ————————————————————————
[ERROR] BUILD ERROR
[INFO] ————————————————————————
[INFO] Failed to resolve artifact.

Anyway, I have decided to delete the repository and start again!