Is there any Apache Click maven archtype similar to Wicket's? - maven

Is there any Apache Click maven archetype similar to Wicket's quick start? Similar to http://wicket.apache.org/start/quickstart.html
Basically what I need is a way to get started using Apache Click quickly using Maven.
Thanks in advance.

I never tried it myself, but this project provides a maven archetype for click. It doesn't look like they provide it in a public repository, so you will need to check the sources, compile&install it and than you'll be able to use it, e.g.:
$ svn checkout http://construtor.googlecode.com/svn/trunk/ construtor-read-only
$ cd construtor-read-only/maven-archetype-click/
$ mvn clean install
$ mvn archetype:generate
[...]
387: local -> maven-archetype-click (An archetype which generates a simplifed sample of the Apache Click Framework.)
[...]

For the benefit of future enquirers, there are instructions to achieve this here. However, the remote build did not work for me using Maven 3 nor did the local installation suggested without some modifications. This is what worked for me:
Download the archetype jar file
Install the archetype in the local maven 3 repo:
mvn install:install-file -DgroupId=com.google.constructor.archetypes -DartifactId=maven-archetype-click -Dversion=1.0 -Dpackaging=jar -Dfile=\maven-archetype-click-1.0.jar
Generate skeleton project:
mvn archetype:generate -DarchetypeGroupId=com.google.constructor.archetypes -DarchetypeArtifactId=maven-archetype-click -DarchetypeVersion=1.0 -DgroupId=com.test -DartifactId=clickprimer -DarchetypeCatalog=local
cd clickprimer
mvn clean package
mvn jetty:run

Related

How to install Maven archetype from local JAR and POM, and also update local catalog

I want to distribute a custom archetype JAR and POM, without deploying them to a Maven repository, so that someone can grab them and install in their local repository with something like a mvn install:install-file -Dfile <file> -DpomFile <pom>.
But if one just does:
mvn install:install-file -Dfile=./my-archetype-1.0.jar -DpomFile=./my-archetype-1.0.pom
the local catalog doesn't get updated.
Though there are similar questions like this, this and this, they left me missing a small step.
I'm not sure how to run the mvn archetype:update-local-catalog that they mention. Where's the pom.xml?
Simply run mvn -f <archetypePomFile> archetype:update-local-catalog doing a mvn -f pointing to the archetype pom.
So altogether it's:
Install archetype
mvn install:install-file -Dfile=./my-archetype-1.0.jar -DpomFile=./my-archetype-1.0.pom
Update local catalog
mvn -f my-archetype-1.0.pom archetype:update-local-catalog
Maybe that's obvious to others reading the doc but I spent enough time on this that I thought I'd write it up.

Maven 3 - Unable to find archetype

I have created a customized archetype, customA-web-archetype. Within the project folder, customA-web-archetype , I ran mvn clean install archetype:update-local-catalog which was successful. Now when I run mvn archetype:generate -DarchetypeCatalog=local outside the folder to use the archetype, I am getting the following error:
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
Your filter doesn't match any archetype (hint: enter to return to initial list)
FYI- When I was setting up Maven, I moved the .m2 to a different directory rather than using the default home directory. I made the appropriate change to settings.xml so that it can find the .m2 in the updated directory structure.
I am not using any repo manager such as Nexus. Just a local m2 repo sitting on the same box as the archetype project.
To run the archetype command, you need to specify the groupId, artefactId and version of your archetype, as well as those of your future maven project.
You should try the following command, with your own parameters:
mvn archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=yourArchetypeGroupId -DarchetypeArtifactId=yourArchetypeArtifactId -DarchetypeVersion=yourArchetypeVersion -DgroupId=projectGroupId -DartifactId=projectArtifactId -DinteractiveMode=false
After upgrading from Maven 2 to 3 we found the same problem. The fix was to change the version of the archetype-packaging and maven-archetype-plugin from 2.2 to 3.0.0 in the archetype pom.
I looks like maven moved the location of it's archetype repository file from ~/.m2 to ~/.m2/repositories which is why generate wasn't finding it.
One strange behavior I'm still seeing is that if I just do
mvn archetype:generate
it doesn't show my local archetypes, however if I do a
mvn archetype:generate -DarchetypeCatalog=local
it shows up. Hope this helps.
Have you tried crawling the repo to create a catalog? Perhaps it's missing / broken? Archetype plugin has crawl goal, which parses the repo and creates catalog.xml.
mvn archetype:help
[... snip ...]
archetype:crawl
Crawl a Maven repository (filesystem, not HTTP) and creates a catalog file.

Run tomcat project without pom.xml (like yum or apt-get)

For a presentation purpose and installation handbook i like to run a tomcat-project directly with only maven installed.
I googled around an found:
a way to download the dependency directly my mvn dependency:get
a way to start the war by mvn tomcat7:run
Is there any way to have a short shell-command who download the dependency from the server, compile and start it?
Actually i got this:
mvn dependency:get tomcat7:run
-DgroupId=XXXXX
-DartifactId=hasty-tumbleweed
-Dversion=0.9.2-SNAPSHOT
-DrepoUrl=file://C:/Users/woodcraft.xenther-vladic/.m2/repository
But mvn still try to find the plugin from the official maven repository.
Any Idea?
Are you maybe missing this:
Caveat: will always check the central repository defined in the super pom
From the little information here, you make it look as if you're distributing files already (the repository stuff) so why not provide a POM as well, opening you up to doing whatever nifty Maven stuff you desire. Then you can do:
mvn install -f <path to your POM>

How to register my maven archetype so that it gets listed as part of archetype:generate

How to register my maven archetype so that it gets listed as part of mvn archetype:generate call?
the mvn archetype:generate command lists the archetype defined in the catalog file from the maven central repository...
This catalog is meant to contains stable and reliable archetypes...
If your archetype will help us to save the world, you should create a JIRA and ask for them to register you project: https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
Otherwise you can setup a local catalog that will be used to spread your project.
HIH
M.
you can install the archtype ( mvn install) into your local repository first and then it will be available for mvn archetype:generate command.
mvn archetype:generate -DarchetypeGroupId=gpid -DarchetypeArtifactId=archetype

Where can I get the NaturalDocs Maven plugin?

The maven configuration mentioned in the Usage section of the Natural Docs Maven Plugin site:
<groupId>org.codehaus.mojo.naturaldocs</groupId>
<artifactId>naturaldocs-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
However; I can't seem to find any version in any Maven repository including Maven Central or the Snapshot repo.
I was able to find what seems like the initial version attached to this Mojo plugin submission but it only includes source, and while it's nice to look at I don't wish to compile it for use myself.
Grab the source archive that you referenced and unzip it in a convenient spot.
From that folder, run:
mvn clean install
Assuming that runs without issue, run:
mvn install:install-file -Dpackaging=jar -Dfile=target\naturaldocs-maven-plugin-1.0-SNAPSHOT.jar -DgroupId=org.codehaus.mojo.naturaldocs -DartifactId=naturaldocs-maven-plugin -Dversion=1.0-SNAPSHOT
Assuming that runs fine, check the local deploy works as expected by including the pom reference in your project.
<dependency>
<groupId>org.codehaus.mojo.naturaldocs</groupId>
<artifactId>naturaldocs-maven-plugin</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
If your project build without issue, then deploy it to your local Maven repo by running:
mvn deploy:deploy-file -Dpackaging=jar-Drepository=extNonFree -Durl=scpexe://maven.your-company.com/your-serverpath/maven/proximity/ext-non-free/storage -Dfile=target\naturaldocs-maven-plugin-1.0-SNAPSHOT.jar -DgroupId=org.codehaus.mojo.naturaldocs -DartifactId=naturaldocs-maven-plugin -Dversion=1.0-SNAPSHOT
Or have one of your local Maven admins deploy the pom and jar manually.
I hope that helps.

Resources