Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

artifactId/

project directory

|-- .cvsignore

contains files that are local to build: target, profiles.xml, etc

|-- pom.xml

POM file

|-- profiles.xml

local, user and project dependent profile definitions; this should not be version controlled

|-- LICENSE.txt

license of the project

|-- README.txt

welcome to the reader

|-- src/

original src material; this should be version controlled

    |-- main/

the original material for the artifact

        |-- java

root of main Java source; will be compiled into target/classe

        |-- resources/

main Java resources; will be copied into target/classes

        |-- webapp/

web application with standard web application structure

            |-- WEB-INF/

 

            |     '-- web.xml

 

            '-- index.jsp

 

        |-- assembly/

 

            '-- dep.xml

assembly descriptor for maven-assembly-plugin

        |-- filters/

resource filter properties files for main Java resources

        |-- config/

configuration files for the artifact

        |-- bash/

sources in other technologies for the artifact

        |-- python/


           |-- sql/


    |-- site/

project documentation in different formats; mvn site will produce a project website in target/site based on this material and structure (Doxia)

           |-- fml/

documentation in FML format (XML based FAQ format)

               '-- faq.fml


        |-- resources/

 

               |-- css/

 

            |-- img/

 

            |-- js/

site resources; will be copied into target/site as-is

        |-- site.xml

site descriptor: description of site structure; this will generate menus

        |-- xdoc/

 

            '-- xdoc.xml

documentation in Xdoc format (XML based HTML generation; maven 1 legacy)

    |-- test/

original material to test the artifact

        |-- java/

root of Java source for testing the artifact; usually JUnit test classes; will be compiled into target/test-classes

        |-- resources/

resources for testing the artifact; will be copied into target/test-classes

        |-- filters/

resource filter properties files for resources for testing the artifact

        |-- python/

sources in other technologies for testing the artifact

|-- target/

generated material; this should not be under version control

   |-- artifactId-version.jar

generated artifact

   |-- classes/

result of compilation of src/main/java and copy of src/main/resources

   |-- exported-pom.xml

consolidated POM

   |-- javadoc/

javadoc of src/main/java

   |-- site/

project site generated by mvn site

   |-- surefire-reports/

test reports

   |-- test-classes/

result of compilation of src/test/java and copy of src/test/resources

   |-- announcement/


       '-- announcement.vm

org.codehaus.mojo:changelog-maven-plugin generates announcement mail here

|-- denotes subdirectory

'-- denotes file in the directory

...

If we run mvn install target with this POM file, it will still not build completely as we need to locate dependencies that are not found in the parent POM central repositories (modules and plugins): http://repo1.maven.org/maven2Image Removed

Maven 2 profile files

...

Code Block
<profile>
<id>profile1</id>
[...]
<activation>
<property>
<name>debug</name>
</property>
</activation>
</profile>

This will activate the profile when the system property "debug" is specified with any value.
         3.3 

<profile>
<id>profile1</id>
...
<activation>
<property>
<name>environment</name>
<value>test</value>
</property>
</activation>
</profile>

Code Block
This last example will activate the profile when the system property "environment" is specified with the value "test".


h3. (e)	profiles.xml  file for org-glast-groupmanager

Based on the general discussion above of profiles, I  have chosen initially the following profiles.xml file. 

Note: settings.xml file in my Maven2 repository directory (~igor/.m2) is just:

{code:title=settings.xml}
<?xml version="1.0" encoding="UTF-8"?>
<settings>
</settings>

The profiles file will initially point to project specific repositories that are needed to complete the dependency resolution. In the transition period, when some of the files are in Maven 1 repositories (both GLAST and developer ) and only some of the files are in GLAST Maven 2 respository:

http://glast-ground.slac.stanford.edu/maven2/Image Removed or
/nfs/slac/g/glast/ground/maven2

we need to establish the set of repositories to follow the following path in the order of precedence:

1.http://repo1.maven.org/maven2/Image Removed
2. any outside repositories not in maven2 repository above (like apache.org, sun.com, freehep.org)
3.http://glast-ground.slac.stanford.edu/maven2/Image Removed
4.http://glast-ground-slac.stanford.edu/maven1/Image Removed
5. and only than developer specific repositories:
6. ~developer/.m2/repository
7. ~developer/.maven/repository

...

They can be viewed through the web interface
http://glast-ground.slac.stanford.edu/maven2/Image Removed

GLAST parent POM

...

Code Block
titleGLAST parent POM
<project xmlns="http://maven.apache.org/POM/4.0.0"   
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>glast</groupId>
  <artifactId>maven-parent</artifactId>
  <version>1.0-SNAPSHOT</version>
  <organization>
    <name>Glast</name>
    <url>http://glast-ground.slac.stanford.edu</url>
  </organization>
  <repositories>
    <repository>
      <id>glast-maven</id>
      <name>GLAST Maven 2 Repository</name>
      <url>
        http://glast-ground.slac.stanford.edu/maven2/
      </url>
      <releases>
        <enabled>false</enabled>
      </releases>
    </repository>
    <repository>
      <id>glast-maven-snapshots</id>
      <name>GLAST Snapshot Repository</name>
      <url>
        http://glast-ground.slac.stanford.edu/maven2/SNAPSHOTS 
      </url>
      <releases>
        <enabled>false</enabled>
      </releases>
    </repository>
  </repositories>
</project>

...

Code Block
titleGLAST repositories
  <!-- use the following in  if you're not using a snapshot version. xxxx-->
  <repository>
     <id>glast-maven2</id>
     <name>GLAST Maven 2 central repository</name>
     <url>scp://glast-java.slac.stanford.edu:/nfs/slac/g/glast/ground/maven2/</url>
  </repository>
  <!-- use the following if you ARE using a snapshot version. -->
  <snapshotRepository>
     <id>glast-maven2-snapshots</id>
     <name>GLAST Maven2 centreal SNAPSHOTS repository</name>
     <url>scp://glast-java.slac.stanford.edu:/nfs/slac/g/glast/ground/maven2/SNAPSHOTS</url>
     <!-- this is set to false, to prevent multiple versions of SNAPSHOT files -->
     <uniqueVersion>false</uniqueVersion>
   </snapshotRepository>

...

Code Block
titleGLAST plugin repository
    <pluginRepositories>
        <pluginRepository>
            <id>glast-maven2-plugins</id>
            <name>GLAST Maven2 central PLUGINS repository</name>
            <url>scp://glast-java.slac.stanford.edu:/nfs/slac/g/glast/ground/maven2/PLUGINS</url>
	    <uniqueVersion>false</uniqueVersion>
        </pluginRepository>
    </pluginRepositories>

...

Code Block
titleUsing GLAST parent POM
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <!-- every project POM must include GLAST parent POM -->
  <parent>
      <groupId>glast</groupId>
      <artifactId>maven-parent</artifactId>
      <version>1.0</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>glast</groupId>
  <artifactId>sample-maven-webapp</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Sample Maven Webapp</name>
  <url>http://glast-ground.slac.stanford.edu</url>
  <dependencies>
      <!-- enter project specific POM -->
  </dependencies>
  <build>
    <finalName>sampleMavenWebapp</finalName>
  </build>
</project>

...

Using ssh at SLAC is nicely described in:
http://glast-ground.slac.stanford.edu/workbook/Image Removed (Under Getting Conntected, Secure Shell).

To learn about ssh and different authentication strategies http://www.linux.com/articles/34958?tid=78&tid=82Image Removed

Basic requirement is that you need to be able to do scp without password authentication.

...

Most of the time there is no configuration for repositories in the pom.xml configuration file
because there is a built-in default repository (pointing to http://repo1.maven.org/maven2Image Removed).
Most of the time, open source projects will publish artifacts to the central repository, but they
can also host their own repositories and not made them available.

...

To integrate Hibernate into the web application, two different types of dependencies are
required: for the Hibernate code itself, and for the JPA and transactional APIs that are implemented.
The JBoss repository contains both of these types, so configuring the pom.xml configuration
file is easy. A new repositories tag is added under the top-level project tag, which in
turn contains a repository tag with an id tag (providing a unique identifier) and a url tag
(that supplies the URL of the repository).
<project>
...
<repositories>
<repository>
<id>jboss</id>
<url>http://repository.jboss.com/maven2Image Removed</url>
</repository>
</repositories>
<project>

...

Code Block
mvn install:install-file -DgroupId=<groupId>
-DartifactId=<artifactId> 
-Dversion=<version>
-Dpackaging=jar 
-Dfile=</path/to/downloaded/file>

...

Note Each Hibernate dependency also has its own dependencies, known as transitive dependencies.
When the project you are using is built for Maven2, the transitive dependencies are configured and downloaded
automatically with the dependency that you have configured. But occasionally, you will encounter
a project that has not been built for Maven2. In this case, you need to add each of the transitive dependencies
individually to the pom.xml configuration file manually.

Guide to using Maven 1.x repositories with Maven 2.x

When you are migrating from Maven 1.x to Maven 2.x you will first be trying to convert your build and to make this easier we have provided a way for you to use your existing Maven 1.x repository so that you don't have to convert your repository before trying to migrate your projects. To use a Maven 1.x repository with your Maven 2.x project you need to specify this in your POM as follows:<project>
...
<repositories>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>my-m1-repository</id>
<name>Maven 1.x Repository</name>
<url>http://repostory.mycompany.com/maven1Image Added</url>
<layout>legacy</layout>
</repository>
</repositories>
...

</project>

Enabling the snapshots is important as Maven 2.x makes a distinction between repositories that contain snapshots and those that don't. In Maven 1.x there is no distinction, so setting snapshots to true will give you the Maven 1.x style repository behavior while using Maven 2.x

Web application deployments on tomcat servers

...