Friday, December 12, 2008

Bookmark and Share
For a recent project, a colleague of mine and I created a Maven archetype, allowing for a very simple creation of web service projects (more to follow in a future post). Everything worked out fine on our boxes, but another colleague we asked for testing the archetype, reported, that he had some trouble using it.

After some investigations, we found out, that there is an issue with the Maven archetype plugin, which ignores your proxy settings, if you specify an archetype catalog (This JIRA-Issue seems to describe that problem). So, if you are sitting behind a web proxy, e.g. the command
$ mvn archetype:generate -DarchetypeCatalog=
might lead to the following error after some time:
[WARNING] Error reading archetype catalog
For me, it helped to remove the archetype plugin from my local Maven repository by deleting the folder /home/<username>/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin before issuing the command above.

This forces Maven to download the archetype plugin again, for some reason causing it to find the archetype catalog properly. If I try to create another project from using the catalog – having the archetype plugin in my local repo now – the same error as before occurs.


Heath Raftery said...

Thanks for posting - I thought I could finally stop tearing my hair out but alas, the great wall of proxy has maintained its defences.

I have proxy configuration set up in my settings.xml, which is obviously working because executing the archetype:generate command manages to download maven-archetype-plugin version 2.0-alpha-4 first. It then gets to the "Generating project in Interactive mode" part and hangs before showing the connection timed out error.

It's interesting that you managed to get it working this way. I wonder why my install is more stubborn. One more vote to fix this problem. Next step, investigate maven-archetype-plugin itself.

Heath Raftery said...

I posted a simple workaround to the project's relevant issue.