Recent Notes

Displaying keyword search results 91 - 100
Created by Fang on August 22, 2009 21:48:12    Last update: January 10, 2010 00:29:08
The POM (Project Object Model, pom.xml ) is at the heart of all Maven builds. It tells Maven how to build your project, just like build.xml for Ant. This is a POM for a simple Hello World project: <project xmlns="http://maven.apache.org/POM/4.0.0"... Not much can be inferred from the POM file alone, because lots of information is implied . For example, packaging defaults to jar , which means that if nothing is specified, Maven compiles all java files under src/main/java and creates a jar . All Maven POMs inherit from a base Super POM. To see the effective POM for your project, type mvn help:effective-pom : C:\maven\hello-world>mvn help:effective-pom Below is the Super POM for Maven 2.0.x. <project> <modelVersion>4.0.0</modelVersion> ...
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 08, 2009 03:40:22    Last update: January 10, 2010 00:19:17
The Maven EJB plugin defaults to version 2.1. You get this error when you try to assemble an EJB without a corresponding ejb-jar.xml : [INFO] Error assembling EJB: META-INF/ejb-jar.xm... If you are targeting EJB 3, you should add this to pom.xml : <build> <plugins> <plugin> ... Reference: Maven EJB plugin .
Created by Fang on August 13, 2009 02:59:06    Last update: January 09, 2010 23:36:44
Maven requires JAVA_HOME to be set but the setting is tricky. It doesn't like a PATH inside quotes with a space in it. C:\>@rem quotes and space doesn't work C:\>set ...
Created by Fang on August 26, 2009 02:44:56    Last update: January 09, 2010 21:51:45
In Maven, all work is done by plugins. Without plugins, maven is just an empty shell. Plugins define goals that attach to build phases. Plugins expand available packaging types. For example, compilation is done by the compiler plugin; unit tests are executed by the surefire plugin. Plugins are documented here: http://maven.apache.org/plugins/
Created by Dr. Xi on January 08, 2010 03:53:37    Last update: January 08, 2010 03:54:56
This is an Ant custom task to merge Properties files I lifted from http://marc.info/?l=ant-user&m=106442688632164&w=2 , with some minor bug fixes. Example usage: <taskdef name="mergeProperty" classname="ant.task.... Implementation: package ant.task.addon; import java.io.Buff...
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 September 02, 2009 02:46:42    Last update: September 02, 2009 02:47:08
From http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html . There are 6 scopes available: compile : This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects. provided : This is much like compile , but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive. runtime : This scope indicates that the dependency is not required for compilation,...
Created by Fang on August 21, 2009 03:05:23    Last update: August 22, 2009 22:10:06
There are three built-in build lifecycles: default: handles your project deployment clean: handles project cleaning site: handles the creation of your project's site documentation Each of these build lifecycles is defined by a different list of build phases, wherein a build phase represents a stage in the lifecycle. The default lifecycle has the following most common build phases (among others): Phase Description validate validate the project is correct and all necessary information is available compile compile the source code of the project test test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed package take the compiled code and package it in its distributable format, such as a JAR. integration-test process and deploy...
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"...
Previous  3 4 5 6 7 8 9 10 11 12 Next