Displaying keyword search results 1 - 5
Created by Fang on September 07, 2009 20:44:15 Last update: November 03, 2011 14:43:19
Step 1: Repackage a web app as EAR A Java EE application is a multimodule Maven project. At the very least you'll need to package a WAR and an EAR. To get started, I'll simply re-package the simple webapp as an EAR. Create a directory named javaee-app Copy the webapp from here to javaee-app . Rename struts1app to webapp . Create pom.xml under javaee-app :
<project> <modelVersion>4.0.0</modelVersion>...Create a directory named ear under javaee-app . Create pom.xml under ear :
<project> <modelVersion>4.0.0</modelVersion>...Modify pom.xml in the webapp directory so that it looks like this:
<project> <modelVersion>4.0.0</modelVersion> ...Build with " mvn package " in the javaee-app directory. You can see that ear-1.0.ear is successfully generated in javaee-app/ear/target . Maven successfully resolves dependencies between the sub-projects....
Created by Dr. Xi on February 28, 2011 15:39:08 Last update: February 28, 2011 15:39:08
For simple projects, archetype:generate seemed too heavy for me, but creating the standard Maven file structure by hand is such a chore. So I created this simple script to ease the pain:
#!/bin/sh if [ $# -lt 4 ]; then echo "Us...Example usage:
./initmvn.sh myProject theGroupId theArtifactId co...
Created by Fang on August 26, 2009 02:50:20 Last update: January 10, 2010 00:22:44
You can use the Maven archetype plugin to quickly start a new Maven project from scratch:
C:\work\maven>mvn archetype:generate [INFO] S...
Created by Fang on September 07, 2009 16:39:37 Last update: September 07, 2009 18:43:04
It's easiest to use the archetype plugin to start a new Maven project. I'll use struts 1 as example since it's not in the built-in archetypes for archetype:generate . Generate a simple webapp with archetype:generate :
C:\work\maven>mvn archetype:generate -DarchetypeAr...It generates a directory structure like this:
struts1app struts1app/pom.xml struts1app/src...with a simple POM:
<project xmlns="http://maven.apache.org/POM/4.0.0"...Create settings.xml in $HOME/.m2 , add Java.net repository for Java EE dependencies:
<?xml version="1.0" encoding="UTF-8"?> <setting...Add Java EE and Struts dependencies in pom.xml . Note that the Java EE dependency has scope provided , meaning that the web app container provides the jars, therefore we don't need to bundle them with our war fie.
<project xmlns="http://maven.apache.org/POM/4.0.0"...Create a directory named java under main , create the Struts form and...
Created by Fang on August 13, 2009 04:18:26 Last update: August 13, 2009 04:18:26
To start a simple "Hello World" project in maven, enter:
mvn archetype:create -DgroupId=com.example -Dartif...in the command line. It will take a while for Maven to run. But eventually it will create the standard Maven directory structure with a "Hello World" app and a fake JUnit test. Enter
mvn packagewill build the simple App into a jar under the target directory. Run the resulting App:
C:\maven\hello-world>java -cp target\hello-world-1...This is the generated pom: