Results 1 to 3 of 3

Thread: Migrate Maven 2.0.9 to 3.0.4 problems in STS

Threaded View

  1. #1
    Join Date
    Oct 2012
    Posts
    2

    Default Migrate Maven 2.0.9 to 3.0.4 problems in STS

    I have existing projects that were built using Maven 2.0.9. Our development tools is the Helios distribution of Eclipse. Our projects use a nested POM approach. We build from the command line mvn clean install using an archetype (see below). All of our projects point to a <parent> pom that is in a global project called "BuildStandards". BuildStandards is built and located in the .m2/repository along with all other dependencies defined in both BuildStandards, the root POM of a specific project, and, all of the POMs in all of the project's sub-folders. This all works.

    We want to upgrade from Helios to the latest STS, which means migrating to Maven 3.0.4. I have modified the POMs to reference the Maven installation installed with STS as well as configured my system's environmental variables to target the same installation.

    Here are the steps I've taken so far:
    1. Point to Maven 3.0.4
    2. delete classpath reference to maven 2 in the .classpath file
    3. run mvn clean install (Maven 3.0.4) - BUILD SUCCESS
    4. import project into STS
    5. convert project to Maven project
    6. update maven dependencies


    After doing this, and many other variations in the process, none of the dependencies outside of the project itself (Spring, BuildStandards, etc) are seen.

    It appears that STS does not work with nested POMs even though Maven does. It seems that if I put each module (as defined in the POM) as separate projects, then it can work; however, then the problem seems to be that if you use one of the modules by another project and, that module has a dependency on another Module that is not needed by the external project, then there can be conflicts in classpath resolution.

    Does anyone have experience in migrating from large, nested-POM based projects to STS's Juno distribution, and, migration from Maven 2 to Maven 3 as it pertains to STS?

    BuildStandards pom.xml
    Code:
    <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>com.fitness</groupId>
       <artifactId>build-standards</artifactId>
       <version>2.5</version>
       <packaging>pom</packaging>
    
       <name>Build Standards - 24 Hour Fitness Master POM</name>
       <description>Master POM for 24 Hour Fitness</description>
        <inceptionYear>2006</inceptionYear>
    
       
       <properties>
        ...
          <com.fitness.maven.version>3.0.4</com.fitness.maven.version>
          <com.fitness.spring.version>3.1.2</com.fitness.spring.version>
          <com.fitness.architecture-common.version>1.1.0-SNAPSHOT</com.fitness.architecture-common.version>
          <com.fitness.domain-objects.version>1.1.0-SNAPSHOT</com.fitness.domain-objects.version>
          <com.fitness.framework-architecture.version>1.0.1-SNAPSHOT</com.fitness.framework-architecture.version>
          <com.fitness.framework-error.version>1.3.0-SNAPSHOT</com.fitness.framework-error.version>
          <com.fitness.framework-persistence.version>1.1.0-SNAPSHOT</com.fitness.framework-persistence.version>
          <com.fitness.manifest-reader.version>1.1.0</com.fitness.manifest-reader.version>
          ...
    
       </properties>
    
       <profiles>
          <profile>
                <id>com.fitness.env.buildserver</id>
             <activation>
                <os>
                   <name>Linux</name>
                </os>
             </activation>
             <properties>
                <com.fitness.dist.base.url>file:///var/www/localhost/htdocs/maven</com.fitness.dist.base.url>
                <com.fitness.site.base.url>http://${com.fitness.buildServer}/maven/site</com.fitness.site.base.url>
              ...
             </properties>
          </profile>
                   ...
    
       </profiles>
    
       <prerequisites>
          <maven>${com.fitness.maven.version}</maven>
       </prerequisites>
    
          <dependencyManagement>
          <dependencies>
            
             <dependency>
                <groupId>com.fitness.architecture</groupId>
                <artifactId>architecture-error</artifactId>
                <version>${com.fitness.framework-architecture.version}</version>
             </dependency>
             <dependency>
                <groupId>com.fitness.architecture</groupId>
                <artifactId>architecture-common</artifactId>
                <version>${com.fitness.architecture-common.version}</version>
             </dependency>
             <dependency>
                <groupId>com.fitness.architecture.persistence</groupId>
                <artifactId>architecture-persistence</artifactId>
                <version>${com.fitness.framework-persistence.version}</version>
             </dependency>
             <dependency>
                <groupId>com.fitness.domain</groupId>
                <artifactId>domain-objects</artifactId>
                <version>${com.fitness.domain-objects.version}</version>
             </dependency>
             <dependency>
                <groupId>com.fitness.framework.util</groupId>
                <artifactId>ManifestReader</artifactId>
                <version>${com.fitness.manifest-reader.version}</version>
             </dependency>
            
             <!-- Spring Framework -->
             <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${com.fitness.spring.version}</version>
             </dependency>
    
              ....
    
          </dependencies>
       </dependencyManagement>
    
          ...
    
       <build>
          <plugins>
             <plugin>
                <groupId>com.keyboardsamurais.maven</groupId>
                <artifactId>maven-timestamp-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                   <propertyName>com.fitness.build.timestamp</propertyName>
                   <timestampPattern>MM.dd.yyyy HH:mm</timestampPattern>
                </configuration>
                <executions>
                   <execution>
                      <goals>
                         <goal>create</goal>
                      </goals>
                   </execution>
                </executions>
             </plugin>
             <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                   <execution>
                      <id>enforce-versions</id>
                      <goals>
                         <goal>enforce</goal>
                      </goals>
                      <configuration>
                         <rules>
                            <requireMavenVersion>
                               <version>${com.fitness.maven.version}</version>
                            </requireMavenVersion>
                            <requireJavaVersion>
                               <version>${com.fitness.java.version}</version>
                            </requireJavaVersion>
                         </rules>
                      </configuration>
                   </execution>
                  
                </executions>
             </plugin>
            
          </plugins>
    
       </build>
    </project>

    Root pom.xml in project that uses the BuildStandards pom.xml declared in <parent>
    Code:
    <?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">
       <parent>
          <groupId>com.fitness</groupId>
          <artifactId>build-standards</artifactId>
          <version>2.5</version>
       </parent>
    
       <modelVersion>4.0.0</modelVersion>
    
       <groupId>com.fitness.order</groupId>
       <artifactId>order-services</artifactId>
       <version>1.1.0-SNAPSHOT</version>
       <packaging>pom</packaging>
    
       <name>OrderServices - ${project.version}</name>
       <description>${name}</description>
    
    
       <properties>
          <com.fitness.base.project.id>OrderServices</com.fitness.base.project.id>
       </properties>
    
    
       <scm>
          <connection>scm:svn:http://sequoia/itdev/applications/OrderServices/branches/1.1.0</connection>
          <developerConnection>scm:svn:http://sequoia/itdev/applications/OrderServices/branches/1.1.0</developerConnection>
          <url>http://sequoia/itdev/applications/OrderServices/branches/1.1.0</url>
       </scm>
    
       <modules>
          <module>Common</module>
          <module>Domain</module>
          <module>Services</module>
          <module>IntegrationTests</module>
       </modules>
    
       <dependencyManagement>
          <dependencies>
             <!-- ********************************** * Intra-Project Dependencies * ********************************** -->
    
             <dependency>
                <groupId>com.fitness.order</groupId>
                <artifactId>order-common-test-util</artifactId>
                <version>${project.version}</version>
             </dependency>
    
             <dependency>
                <groupId>com.fitness.order</groupId>
                <artifactId>order-common-exceptions</artifactId>
                <version>${project.version}</version>
             </dependency>
    
    ...
    Last edited by jpgaber; Oct 31st, 2012 at 03:44 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •