[MRM-952] (also fixes MRM-615, MRM-844 and MRM-620)

submitted by Michal Stochmialek
- fixes problems with expression resolving (${pom.version}) in dependencies,
- adds support for parent.{groupId, artifactId, version) properties,
- fixes issues with jdo detachCopy called from ProjectModelToDatabaseListener while creating effective pom,
- fixes inconsistency in key format used in effective model cache,
- add merging parentProject and properties while creating effective pom,
- ArchivaProjectModel.setOrgin("filesystem") was moved to readers (where IMO should be),
- adds few new test cases.

additional changes:
- applied codestyle formatting to patch


git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@703626 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maria Odea B. Ching 2008-10-11 03:56:18 +00:00
parent c127dd4a11
commit a6c9464436
33 changed files with 1555 additions and 29 deletions

View File

@ -137,7 +137,7 @@ public static boolean isSnapshot( String version )
}
else
{
return version.endsWith( SNAPSHOT );
return isGenericSnapshot(version);
}
}

View File

@ -32,6 +32,7 @@
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.ObjectNotFoundException;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaModelCloner;
import org.apache.maven.archiva.model.ArchivaProjectModel;
import org.apache.maven.archiva.model.Keys;
import org.apache.maven.archiva.model.RepositoryProblem;
@ -41,7 +42,6 @@
import org.apache.maven.archiva.repository.RepositoryException;
import org.apache.maven.archiva.repository.content.ManagedLegacyRepositoryContent;
import org.apache.maven.archiva.repository.project.ProjectModelException;
import org.apache.maven.archiva.repository.project.ProjectModelFilter;
import org.apache.maven.archiva.repository.project.ProjectModelReader;
import org.apache.maven.archiva.repository.project.filters.EffectiveProjectModelFilter;
import org.apache.maven.archiva.repository.project.readers.ProjectModel300Reader;
@ -85,11 +85,6 @@ public class ProjectModelToDatabaseConsumer
*/
private RepositoryContentFactory repositoryFactory;
/**
* @plexus.requirement role-hint="expression"
*/
private ProjectModelFilter expressionModelFilter;
/**
* @plexus.requirement role="org.apache.maven.archiva.repository.project.ProjectModelFilter"
* role-hint="effective"
@ -160,23 +155,22 @@ public void processArchivaArtifact( ArchivaArtifact artifact )
{
model = reader.read( artifactFile );
model.setOrigin( "filesystem" );
// The version should be updated to the artifact/filename version if it is a unique snapshot
if ( VersionUtil.isUniqueSnapshot( artifact.getVersion() ) )
{
model.setVersion( artifact.getVersion() );
}
// Filter the model
model = expressionModelFilter.filter( model );
// Resolve the project model
// Resolve the project model (build effective model, resolve expressions)
model = effectiveModelFilter.filter( model );
if ( isValidModel( model, repo, artifact ) )
{
log.debug( "Adding project model to database - " + Keys.toKey( model ) );
// Clone model, since DAO while detachingCopy resets its contents
// This changes contents of the cache in EffectiveProjectModelFilter
model = ArchivaModelCloner.clone( model );
dao.getProjectModelDAO().saveProjectModel( model );
}
else
@ -356,5 +350,4 @@ private void removeOldProjectModel( ArchivaProjectModel model )
}
}
}
}

View File

@ -0,0 +1,125 @@
package org.apache.maven.archiva.consumers.database;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.File;
import java.util.Iterator;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
import org.apache.maven.archiva.configuration.Configuration;
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.consumers.ConsumerException;
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.ObjectNotFoundException;
import org.apache.maven.archiva.database.ProjectModelDAO;
import org.apache.maven.archiva.model.ArchivaArtifact;
import org.apache.maven.archiva.model.ArchivaArtifactModel;
import org.apache.maven.archiva.model.ArchivaProjectModel;
import org.apache.maven.archiva.model.Dependency;
import org.apache.maven.archiva.model.Keys;
import org.codehaus.plexus.spring.PlexusInSpringTestCase;
/**
* Test for ProjectModelToDatabaseConsumerTest
*
* @author <a href="mailto:michal.stochmialek@eurobank.pl">Michal Stochmialek</a>
*/
public class ProjectModelToDatabaseConsumerTest
extends PlexusInSpringTestCase
{
private ProjectModelToDatabaseConsumer consumer;
private ProjectModelDAO modelDao;
public void setUp()
throws Exception
{
super.setUp();
ArchivaConfiguration archivaConfig = (ArchivaConfiguration) lookup( ArchivaConfiguration.class );
Configuration configuration = archivaConfig.getConfiguration();
ManagedRepositoryConfiguration repo = configuration.findManagedRepositoryById( "internal" );
repo.setLocation( new File( getBasedir(), "src/test/resources/test-repo" ).toString() );
consumer =
(ProjectModelToDatabaseConsumer) lookup( DatabaseUnprocessedArtifactConsumer.class, "update-db-project" );
modelDao = (ProjectModelDAO) lookup( ProjectModelDAO.class, "jdo" );
}
public void testProcess()
throws Exception
{
ArchivaProjectModel model = processAndGetModel( "test-project", "test-project-endpoint-pom", "2.4.4" );
assertNotNull( model.getParentProject() );
assertEquals( "test-project:test-project:2.4.4", Keys.toKey( model.getParentProject() ) );
assertFalse( model.getDependencyManagement().isEmpty() );
model = processAndGetModel( "test-project", "test-project-endpoint-ejb", "2.4.4" );
assertNotNull( model.getParentProject() );
assertEquals( "test-project:test-project-endpoint-pom:2.4.4", Keys.toKey( model.getParentProject() ) );
assertTrue( hasDependency( model, "test-project:test-project-api:2.4.4" ) );
assertTrue( hasDependency( model, "commons-id:commons-id:0.1-dev" ) );
model = processAndGetModel( "test-project", "test-project", "2.4.4" );
assertFalse( model.getDependencyManagement().isEmpty() );
}
private boolean hasDependency( ArchivaProjectModel model, String key )
{
for ( Iterator i = model.getDependencies().iterator(); i.hasNext(); )
{
Dependency dependency = (Dependency) i.next();
if ( key.equals( Keys.toKey( dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion() ) ) )
{
return true;
}
}
return false;
}
private ArchivaProjectModel processAndGetModel( String group, String artifactId, String version )
throws ConsumerException, ObjectNotFoundException, ArchivaDatabaseException
{
ArchivaArtifact artifact = createArtifact( group, artifactId, version, "pom" );
consumer.processArchivaArtifact( artifact );
ArchivaProjectModel model = modelDao.getProjectModel( group, artifactId, version );
assertEquals( group, model.getGroupId() );
assertEquals( artifactId, model.getArtifactId() );
assertEquals( version, model.getVersion() );
return model;
}
protected ArchivaArtifact createArtifact( String group, String artifactId, String version, String type )
{
ArchivaArtifactModel model = new ArchivaArtifactModel();
model.setGroupId( group );
model.setArtifactId( artifactId );
model.setVersion( version );
model.setType( type );
model.setRepositoryId( "internal" );
return new ArchivaArtifact( model );
}
}

View File

@ -0,0 +1,86 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<component-set>
<components>
<!-- JdoAccess -->
<component>
<role>org.apache.maven.archiva.database.jdo.JdoAccess</role>
<role-hint>archiva</role-hint>
<implementation>org.apache.maven.archiva.database.jdo.JdoAccess</implementation>
<requirements>
<requirement>
<role>org.codehaus.plexus.jdo.JdoFactory</role>
<role-hint>archiva</role-hint>
</requirement>
</requirements>
</component>
<!-- JDO Factory -->
<component>
<role>org.codehaus.plexus.jdo.JdoFactory</role>
<role-hint>archiva</role-hint>
<implementation>org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory</implementation>
<configuration>
<!-- Database Configuration -->
<driverName>org.hsqldb.jdbcDriver</driverName>
<url>jdbc:hsqldb:mem:TESTDB</url>
<userName>sa</userName>
<password></password>
<!-- JPOX and JDO configuration -->
<persistenceManagerFactoryClass>org.jpox.PersistenceManagerFactoryImpl</persistenceManagerFactoryClass>
<otherProperties>
<property>
<name>javax.jdo.PersistenceManagerFactoryClass</name>
<value>org.jpox.PersistenceManagerFactoryImpl</value>
</property>
<property>
<name>org.jpox.autoCreateSchema</name>
<value>true</value>
</property>
</otherProperties>
</configuration>
</component>
<component>
<role>org.codehaus.plexus.cache.Cache</role>
<role-hint>effective-project-cache</role-hint>
<implementation>org.codehaus.plexus.cache.ehcache.EhcacheCache</implementation>
<description>Effective Project Cache</description>
<configuration>
<disk-expiry-thread-interval-seconds>600</disk-expiry-thread-interval-seconds>
<disk-persistent>true</disk-persistent>
<disk-store-path>${java.io.tmpdir}/archiva/effectiveproject</disk-store-path>
<eternal>true</eternal>
<max-elements-in-memory>1000</max-elements-in-memory>
<memory-eviction-policy>LRU</memory-eviction-policy>
<name>effective-project-cache</name>
<overflow-to-disk>false</overflow-to-disk>
<!-- TODO: Adjust the time to live to be more sane (ie: huge 4+ hours) -->
<!-- 45 minutes = 2700 seconds -->
<time-to-idle-seconds>2700</time-to-idle-seconds>
<!-- 30 minutes = 1800 seconds -->
<time-to-live-seconds>1800</time-to-live-seconds>
</configuration>
</component>
</components>
</component-set>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project</artifactId>
<version>2.4.4</version>
</parent>
<groupId>test-project</groupId>
<artifactId>test-project-api</artifactId>
<name>Test Project API</name>
<dependencies>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project-broker-pom</artifactId>
<version>2.4.4</version>
</parent>
<artifactId>test-project-broker-ejb</artifactId>
<name>Test Project Broker EJB</name>
<packaging>ejb</packaging>
<dependencies>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<type>test-jar</type>
<version>${pom.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-api</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</dependency>
<dependency>
<groupId>commons-id</groupId>
<artifactId>commons-id</artifactId>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
<dependency>
<groupId>javax.management</groupId>
<artifactId>jmxri</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project</artifactId>
<version>2.4.4</version>
</parent>
<artifactId>test-project-broker-pom</artifactId>
<name>Test Project Broker POM</name>
<packaging>pom</packaging>
<modules>
<module>broker-ejb</module>
</modules>
</project>

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project</artifactId>
<version>2.4.4</version>
</parent>
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<name>Test Project Commons</name>
<dependencies>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-api</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>commons-id</groupId>
<artifactId>commons-id</artifactId>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
<dependency>
<groupId>javax.management</groupId>
<artifactId>jmxri</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project-endpoint-pom</artifactId>
<version>2.4.4</version>
</parent>
<groupId>test-project</groupId>
<artifactId>test-project-endpoint-ejb</artifactId>
<name>Test Project Endpoint EJB</name>
<packaging>ejb</packaging>
<dependencies>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-api</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<!-- for tests only -->
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<version>${pom.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-id</groupId>
<artifactId>commons-id</artifactId>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</dependency>
<dependency>
<groupId>javax.management</groupId>
<artifactId>jmxri</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project</artifactId>
<version>2.4.4</version>
</parent>
<artifactId>test-project-endpoint-pom</artifactId>
<name>Test Project Endpoint POM</name>
<packaging>pom</packaging>
<modules>
<module>endpoint-ejb</module>
</modules>
</project>

View File

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test-project</groupId>
<artifactId>test-project</artifactId>
<name>Test Project</name>
<version>2.4.4</version>
<packaging>pom</packaging>
<organization>
<name>Company</name>
<url>http://www.company.com/</url>
</organization>
<inceptionYear>2002</inceptionYear>
<modules>
<module>api</module>
<module>common</module>
<module>broker</module>
<module>endpoint</module>
</modules>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<!-- common version strategy -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.7</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>commons-id</groupId>
<artifactId>commons-id</artifactId>
<version>0.1-dev</version>
</dependency>
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
<version>1.0.5-xml</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>javax.management</groupId>
<artifactId>jmxri</artifactId>
<version>1.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@ -893,7 +893,7 @@
StringBuffer key = new StringBuffer();
key.append( defaultString( reference.getGroupId() ) ).append( ":" );
key.append( defaultString( reference.getArtifactId() ) ).append( ":" );
key.append( defaultString( reference.getArtifactId() ) );
return key.toString();
}
@ -969,7 +969,7 @@
key.append( defaultString( reference.getGroupId() ) ).append( ":" );
key.append( defaultString( reference.getArtifactId() ) ).append( ":" );
key.append( defaultString( reference.getVersion() ) ).append( ":" );
key.append( defaultString( reference.getVersion() ) );
return key.toString();
}

View File

@ -104,7 +104,8 @@ else if ( VersionUtil.isGenericSnapshot( expected ) )
// check it starts with the same version up to the snapshot part
int leadingLength = expected.length() - 9;
if ( version.startsWith( expected.substring( 0, leadingLength ) ) && version.length() > leadingLength )
if ( leadingLength > 0 && version.startsWith( expected.substring( 0, leadingLength ) ) &&
version.length() > leadingLength )
{
// If we expect a non-generic snapshot - look for the timestamp
Matcher m = SNAPSHOT_PATTERN.matcher( version.substring( leadingLength + 1 ) );

View File

@ -77,6 +77,7 @@ public static ArchivaProjectModel merge( ArchivaProjectModel mainProject, Archiv
ArchivaProjectModel merged = new ArchivaProjectModel();
// Unmerged.
merged.setParentProject(mainProject.getParentProject());
merged.setArtifactId( mainProject.getArtifactId() );
merged.setPackaging( StringUtils.defaultIfEmpty( mainProject.getPackaging(), "jar" ) );
merged.setRelocation( mainProject.getRelocation() );
@ -334,6 +335,7 @@ private static Properties merge( Properties mainProperties, Properties parentPro
}
Properties merged = new Properties();
merged.putAll(mainProperties);
Enumeration keys = parentProperties.propertyNames();
while ( keys.hasMoreElements() )

View File

@ -100,20 +100,23 @@ public ArchivaProjectModel filter( final ArchivaProjectModel project )
// Clone submitted project (so that we don't mess with it)
effectiveProject = ArchivaModelCloner.clone( project );
// Setup Expression Evaluation pieces.
effectiveProject = expressionFilter.filter( effectiveProject );
DEBUG( "Starting build of effective with: " + effectiveProject );
// Merge in all the parent poms.
effectiveProject = mergeParent( effectiveProject );
// Setup Expression Evaluation pieces.
effectiveProject = expressionFilter.filter( effectiveProject );
// Resolve dependency versions from dependency management.
applyDependencyManagement( effectiveProject );
// groupId or version could be updated by parent or expressions
projectKey = toProjectKey( effectiveProject );
// Do not add project into cache if it contains no groupId and
// version information
if ( project.getGroupId() != null && project.getVersion() != null )
if ( effectiveProject.getGroupId() != null && effectiveProject.getVersion() != null )
{
synchronized ( effectiveProjectCache )
{
@ -191,8 +194,8 @@ private ArchivaProjectModel mergeParent( ArchivaProjectModel pom )
if ( parentProject != null )
{
// Merge the pom with the parent pom.
parentProject = expressionFilter.filter( parentProject );
parentProject = mergeParent( parentProject );
parentProject = expressionFilter.filter( parentProject );
// Cache the pre-merged parent.
synchronized ( effectiveProjectCache )

View File

@ -104,11 +104,24 @@ public ArchivaProjectModel filter( final ArchivaProjectModel model )
try
{
// Setup some common properties.
VersionedReference parent = model.getParentProject();
if ( parent != null )
{
String parentGroupId = StringUtils.defaultString( evaluator.expand( parent.getGroupId() ) );
String parentArtifactId = StringUtils.defaultString( evaluator.expand( parent.getArtifactId() ) );
String parentVersion = StringUtils.defaultString( evaluator.expand( parent.getVersion() ) );
props.setProperty( "parent.groupId", parentGroupId );
props.setProperty( "parent.artifactId", parentArtifactId );
props.setProperty( "parent.version", parentVersion );
}
String groupId = StringUtils.defaultString( evaluator.expand( model.getGroupId() ) );
String artifactId = StringUtils.defaultString( evaluator.expand( model.getArtifactId() ) );
String version = StringUtils.defaultString( evaluator.expand( model.getVersion() ) );
String name = StringUtils.defaultString( evaluator.expand( model.getName() ) );
/* Archiva doesn't need to handle a full expression language with object tree walking
* as the requirements within Archiva are much smaller, a quick replacement of the
* important fields (groupId, artifactId, version, name) are handled specifically.

View File

@ -94,6 +94,8 @@ public ArchivaProjectModel read( File pomFile )
model.setProperties( getProperties( xml.getElement( "//project/properties" ) ) );
model.setDependencies( getDependencies( xml ) );
model.setOrigin("filesystem");
/* Following are not valid for <pomVersion>3</pomVersion> / Maven 1 pom files.
*
* model.setDependencyManagement()

View File

@ -104,6 +104,8 @@ public ArchivaProjectModel read( File pomFile )
model.setBuildExtensions( getBuildExtensions( xml ) );
model.setRelocation( getRelocation( xml ) );
model.setOrigin("filesystem");
return model;
}

View File

@ -430,6 +430,16 @@
<artifactId>archiva-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-test-A</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-test-B</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>

View File

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!-- -->
<!-- Generated by Maven Help Plugin on 9/17/08 5:36 PM -->
<!-- See: http://maven.apache.org/plugins/maven-help-plugin/ -->
<!-- -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- -->
<!-- Effective POM for project -->
<!-- 'test-project:test-project-endpoint-ejb:ejb:2.4.4' -->
<!-- -->
<!-- ====================================================================== -->
<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>
<artifactId>test-project-endpoint-pom</artifactId>
<groupId>test-project</groupId>
<version>2.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>test-project</groupId>
<artifactId>test-project-endpoint-ejb</artifactId>
<packaging>ejb</packaging>
<name>Test Project Endpoint EJB</name>
<version>2.4.4</version>
<inceptionYear>2002</inceptionYear>
<organization>
<name>Company</name>
<url>http://www.company.com/</url>
</organization>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-api</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<version>2.4.4</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-id</groupId>
<artifactId>commons-id</artifactId>
<version>0.1-dev</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.management</groupId>
<artifactId>jmxri</artifactId>
<version>1.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.7</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>spring-jdbc</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
<exclusion>
<artifactId>spring-web</artifactId>
<groupId>org.springframework</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>commons-id</groupId>
<artifactId>commons-id</artifactId>
<version>0.1-dev</version>
</dependency>
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
<version>1.0.5-xml</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>javax.management</groupId>
<artifactId>jmxri</artifactId>
<version>1.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@ -295,6 +295,15 @@ public void testGoodLongSnapshotMavenTest()
assertLayout( path, groupId, artifactId, version, classifier, type );
}
/**
* A timestamped versioned artifact but without release version part. Like on axiom trunk.
*/
public void testBadSnapshotWithoutReleasePart()
{
assertBadPath( "org/apache/ws/commons/axiom/axiom/SNAPSHOT/axiom-20070912.093446-2.pom",
"snapshot version without release part");
}
/**
* A timestamped versioned artifact, should reside in a SNAPSHOT baseversion directory.
* @throws LayoutException

View File

@ -169,6 +169,15 @@ public void testExpectWrongSnapshot()
assertNull( parser.expect( "2.0-SNAPSHOT" ) );
}
public void testExpectWrongSnapshot2()
{
// tests parsing axiom snapshots without exceptions
FilenameParser parser = new FilenameParser( "axiom-20080221.062205-9.pom" );
assertEquals( "axiom", parser.nextNonVersion() );
assertNull( parser.expect( "SNAPSHOT" ) );
}
public void testClassifier()
{
FilenameParser parser = new FilenameParser( "artifact-id-1.0-20070219.171202-34-test-sources.jar" );

View File

@ -81,20 +81,29 @@ private ProjectModelResolver createDefaultRepositoryResolver() throws Exception
public void testBuildEffectiveProject()
throws Exception
{
assertEffectiveProject(
"/org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom",
"/archiva-model-effective.pom");
assertEffectiveProject(
"/test-project/test-project-endpoint-ejb/2.4.4/test-project-endpoint-ejb-2.4.4.pom",
"/test-project-model-effective.pom");
}
private void assertEffectiveProject(String pomFile, String effectivePomFile) throws Exception,
ProjectModelException {
initTestResolverFactory();
EffectiveProjectModelFilter filter = lookupEffective();
ArchivaProjectModel startModel = createArchivaProjectModel( DEFAULT_REPOSITORY
+ "/org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom" );
ArchivaProjectModel startModel = createArchivaProjectModel( DEFAULT_REPOSITORY + pomFile );
ArchivaProjectModel effectiveModel = filter.filter( startModel );
ArchivaProjectModel expectedModel = createArchivaProjectModel( "src/test/expected-poms/"
+ "/archiva-model-effective.pom" );
ArchivaProjectModel expectedModel = createArchivaProjectModel( "src/test/expected-poms/" + effectivePomFile);
assertModel( expectedModel, effectiveModel );
}
/**
* [MRM-510] In Repository Browse, the first unique snapshot version clicked is getting persisted in the
* request resulting to 'version does not match' error
@ -272,7 +281,7 @@ private Map<String, Dependency> getDependencyMap( List<Dependency> deps )
while ( it.hasNext() )
{
Dependency dep = it.next();
String key = Dependency.toVersionlessKey( dep );
String key = Dependency.toKey( dep );
map.put( key, dep );
}
return map;

View File

@ -92,6 +92,6 @@ public void testLoadWithNamespace()
assertEquals( "Parent Version", "1.0-SNAPSHOT", parentRef.getVersion() );
assertNotNull( "Dependencies", project.getDependencies() );
assertEquals( "Dependencies.size", 6, project.getDependencies().size() );
assertEquals( "Dependencies.size", 8, project.getDependencies().size() );
}
}

View File

@ -33,6 +33,16 @@
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-test-A</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.archiva</groupId>
<artifactId>archiva-test-B</artifactId>
<version>${parent.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project</artifactId>
<version>2.4.4</version>
</parent>
<groupId>test-project</groupId>
<artifactId>test-project-api</artifactId>
<name>Test Project API</name>
<dependencies>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project-broker-pom</artifactId>
<version>2.4.4</version>
</parent>
<artifactId>test-project-broker-ejb</artifactId>
<name>Test Project Broker EJB</name>
<packaging>ejb</packaging>
<dependencies>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<type>test-jar</type>
<version>${pom.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-api</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</dependency>
<dependency>
<groupId>commons-id</groupId>
<artifactId>commons-id</artifactId>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
<dependency>
<groupId>javax.management</groupId>
<artifactId>jmxri</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project</artifactId>
<version>2.4.4</version>
</parent>
<artifactId>test-project-broker-pom</artifactId>
<name>Test Project Broker POM</name>
<packaging>pom</packaging>
<modules>
<module>broker-ejb</module>
</modules>
</project>

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project</artifactId>
<version>2.4.4</version>
</parent>
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<name>Test Project Commons</name>
<dependencies>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-api</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>commons-id</groupId>
<artifactId>commons-id</artifactId>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
<dependency>
<groupId>javax.management</groupId>
<artifactId>jmxri</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project-endpoint-pom</artifactId>
<version>2.4.4</version>
</parent>
<groupId>test-project</groupId>
<artifactId>test-project-endpoint-ejb</artifactId>
<name>Test Project Endpoint EJB</name>
<packaging>ejb</packaging>
<dependencies>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<groupId>test-project</groupId>
<artifactId>test-project-api</artifactId>
<version>${pom.version}</version>
</dependency>
<dependency>
<!-- for tests only -->
<groupId>test-project</groupId>
<artifactId>test-project-common</artifactId>
<version>${pom.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-id</groupId>
<artifactId>commons-id</artifactId>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</dependency>
<dependency>
<groupId>javax.management</groupId>
<artifactId>jmxri</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>test-project</groupId>
<artifactId>test-project</artifactId>
<version>2.4.4</version>
</parent>
<artifactId>test-project-endpoint-pom</artifactId>
<name>Test Project Endpoint POM</name>
<packaging>pom</packaging>
<modules>
<module>endpoint-ejb</module>
</modules>
</project>

View File

@ -0,0 +1,161 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>test-project</groupId>
<artifactId>test-project</artifactId>
<name>Test Project</name>
<version>2.4.4</version>
<packaging>pom</packaging>
<organization>
<name>Company</name>
<url>http://www.company.com/</url>
</organization>
<inceptionYear>2002</inceptionYear>
<modules>
<module>api</module>
<module>common</module>
<module>broker</module>
<module>endpoint</module>
</modules>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<!-- common version strategy -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>2.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
<version>2.0.7</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.7</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.8</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>commons-id</groupId>
<artifactId>commons-id</artifactId>
<version>0.1-dev</version>
</dependency>
<dependency>
<groupId>org.codehaus.castor</groupId>
<artifactId>castor</artifactId>
<version>1.0.5-xml</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>javax.management</groupId>
<artifactId>jmxri</artifactId>
<version>1.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@ -24,6 +24,7 @@
import org.apache.maven.archiva.database.ArchivaDAO;
import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.ObjectNotFoundException;
import org.apache.maven.archiva.model.ArchivaModelCloner;
import org.apache.maven.archiva.model.ArchivaProjectModel;
import org.apache.maven.archiva.model.VersionedReference;
import org.apache.maven.archiva.repository.project.ProjectModelException;
@ -135,7 +136,9 @@ public void resolutionSuccess( VersionedReference projectRef, ProjectModelResolv
return;
}
model.setOrigin( "filesystem" );
// Clone model, since DAO while detachingCopy resets contents of the model
// this changes behaviour of EffectiveProjectModelFilter
model = ArchivaModelCloner.clone( model );
try
{