Recent Notes
Displaying keyword search results 11 - 14
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 Dr. Xi on November 19, 2008 00:22:27
Last update: January 07, 2010 23:00:36
There is a open source project named [ini4j] for processing Windows .ini configuration files. However, I found it an overkill for my purposes. So here is my simple implementation of a .ini parser. It mimics the standard java.util.Properties class with enhancements to get and set properties by section name. There are only a few simple rules: Leading and trailing spaces are trimmed from section names, property names and property values. Section names are enclosed between [ and ] . Properties following a section header belong to that section Properties defined before the appearance of any section headers are considered global properties and should be set and get with no section names. You can use either equal sign ( = ) or colon ( : )...
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 package
will 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:
<project xmlns="http://maven.apache.org/POM/4.0.0"...