Building Applications with Maven POM Files

To Export Maven POM, Ant Build and a Workspace Metadata Files

  1. Select File > Export > Workshop Build Scripts > Workshop Maven Scripts. Click Next.
  2. In the Export Maven and Ant Scripts pane, select the projects to generate scripts for.
  3. Click Finish to generate the scripts.
    Click Next to define variables to relativize absolute paths in the workspace's .metadata directory

  4. On the Paths screen, The wl.home and workspace.dir will be automatically populated. The purpose of that screen is to define variables to relativize absolute paths in the workspace's .metadata directory. The user can see the remaining absolute paths in the lower box. When a new variable is defined that covers a portion of one of the absolute paths, those absolute paths will be removed from that box. Every variable that’s defined at this point will need to be passed to the ant script at runtime using the -D syntax.

    Click Finish to generate the scripts.

build.xml and pom.xml scripts will be written to the individual project directories.

Executing Maven Scripts

Before you use the generated Maven scripts, you will need to install the Workshop Maven plugin into your local maven repository. To do this from the command line, modify the following example:

mvn install:install-file 
  -Dfile=WorkshopMavenPlugin-1.0.jar 
  -DartifactId=WorkshopMavenPlugin
  -DgroupId=com.mycompany.webapp1 
  -Dpackaging=maven-plugin -Dversion=1.0 -DgeneratePom=true

Also The following shell environment variables are needed when running Maven via the command-line:

JAVA_HOME (for example, set JAVA_HOME= C:\bea\jrockit90_150_06)

WL_HOME (for example, set WL_HOME= C:\bea\wlserver_10.3)

Also the Maven /bin directory must be on the PATH (for example, set PATH= C:\maven-2.0.4\bin;%PATH%)

Now in the directory containing the pom.xml file, you can run a Maven command, for example: mvn clean compile

Related Topics

Understanding the Build Process

Building Applications with Ant Build Files

Precompiling JSP Files

Apache Ant online Manual


Still need help? Post a question on the Workshop newsgroup.