Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

It uses a Maven Archetype to create a Wicket QuickStart project, so requires that Maven 2 be installed & configured beforehand.

...

To create your project, copy and paste the command line generated after typing in the groupId and artifactId in the corresponding textfields, artifactId and version.

HTML
outputhtml

<html>
<body>	

<style>		
	#mvncmd label {
		text-align: right;		
		font-weight: bold;
		width: 100px;
		float: left;
		margin: 0px 5px;		
	}
	#mvncmd input, #mvncmd select, #mvncm span { width: 180px; margin-bottom: 5px; float: left;}
	#mvncmd textarea { width: 400px; height: 100px; }
	#mvncmd br { clear: left; }	
	#mvncmd div { float: left; }
</style>
<script type="text/javascript">
		function changeIt()
			{
				var  groupId = document.form.t1getElementById("groupId").value;
				var artifactId = document.form.t2.getElementById("artifactId").value;
				my_div.innerHTMLvar version = document.getElementById("version").value;
		var cmd = 'mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.3.0-rc1' + version + ' -DgroupId=' + groupId + ' -DartifactId=' + artifactId;
						}
			</script>
	
	

		<form name="form">
			<b>GroupId:</b>
			if (version.match(/.*SNAPSHOT/)) cmd += ' -DremoteRepositories=http://wicketstuff.org/maven/repository/';
		document.getElementById("cmdLine").value = cmd;
	}
</script>
<div id="mvncmd">
<div>
<label for="groupId" title="Base Package">GroupId:</label>
<input type="text" nameid=t1"groupId" value="com.mycompany" onkeyup="changeIt()>
			 <b>;"/><span title="Base Package">&nbsp;(?)</span><br/>
<label for="artifactId" title="Project Name"> ArtifactId:</b>label> 
			<input type="text" nameid=t2"artifactId" value="myproject" onkeyup="changeIt()>
			<br><br>
  ;"><span title="Project Name">&nbsp;(?)</span><br/>
<label for="version" title="Wicket Version">Version:</label>
<select id="version" onchange="changeIt();">
        <option value="1.4-SNAPSHOT">1.4-SNAPSHOT</option> 
        <option value="1.4.9" selected="selected">1.4.9</option>
      <b>Command Line:</b> 
			<div id="my_div">mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.3.0-rc1 -DgroupId=com.mycompany -DartifactId=myproject
			</div>

	</body>
</html> <option value="1.4.8">1.4.8</option>
	<option value="1.3-SNAPSHOT">1.3-SNAPSHOT</option>
        <option value="1.3.7">1.3.7</option>
	<option value="1.3.6">1.3.6</option>
</select><span title="Wicket Version">&nbsp;(?)</span>
</div>
<div>
<label for="cmdLine" id="cmdLabel">Command Line:</label>
<textarea id="cmdLine" onfocus="this.select();">
</textarea>
<script>changeIt();</script>
</div>
<br/>
</div>

Results

This will produce the following project structure/files

No Formatcode
.\myproject
    |   pom.xml
    |
    \---src
        +---main
        |   +---java
        |   |   \---com
        |   |       \---mycompany
        |   |               HomePage.html
        |   |               HomePage.java
        |   |               WicketApplication.java
        |   |
        |   +---resources
        |   |       log4j.properties
        |   |
        |   \---webapp
        |       \---WEB-INF
        |               web.xml
        |
        \---test
            \---java
                \---com
                    \---mycompany
                            Start.java

...

See the Jetty plugin documentation for configuration options, etc.

...

At present, running mvn package or mvn install will result in a NPE from the Surefire (testing) plugin as the generated pom.xml has no dependency on either JUnit or TestNG, which the plugin appears to expect if a src/test/java path is present. To avoid this issue, simply add the following to the <dependencies> section of the pom.xml.

No Format

<dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.2</version>
        <scope>test</scope>
    </dependency>

Using with a specific IDE

  • Eclipse
    • To create an Eclipse project, perform the "mvn eclipse:eclipse -DdownloadSources=true" command inside the project directory.
  • IDEA
    • To create an IDEA project perform the "mvn idea:idea" command inside the project directory, or if using IDEA 7, from within IDEA, just use "File/New Project/Import from external model/Maven", choose the project directory and select the generated pom.xml.
  • NetBeans
    • To create a NetBeans 6 project, just open the pom.xml directly.

More examples

Many more information and examples can be found on our Wiki or here