diff options
author | Maria Odea B. Ching <oching@apache.org> | 2008-10-11 03:56:18 +0000 |
---|---|---|
committer | Maria Odea B. Ching <oching@apache.org> | 2008-10-11 03:56:18 +0000 |
commit | a6c9464436d9667324436fcb965bc1fde9e23ef5 (patch) | |
tree | 00baacb8776247592a46c03d685d3158b97d6d00 /archiva-modules | |
parent | c127dd4a1141820f9a7dba1689de9ea2c689ea1a (diff) | |
download | archiva-a6c9464436d9667324436fcb965bc1fde9e23ef5.tar.gz archiva-a6c9464436d9667324436fcb965bc1fde9e23ef5.zip |
[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
Diffstat (limited to 'archiva-modules')
33 files changed, 1555 insertions, 29 deletions
diff --git a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionUtil.java b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionUtil.java index 2e3831d4a..1ae5831f0 100644 --- a/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionUtil.java +++ b/archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/maven/archiva/common/utils/VersionUtil.java @@ -137,7 +137,7 @@ public class VersionUtil } else { - return version.endsWith( SNAPSHOT ); + return isGenericSnapshot(version); } } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java index 58e1dd9cc..6bc21386a 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java @@ -32,6 +32,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.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.RepositoryContentFactory; 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; @@ -86,11 +86,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 class ProjectModelToDatabaseConsumer { 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 @@ public class ProjectModelToDatabaseConsumer } } } - } diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumerTest.java new file mode 100644 index 000000000..955d2211e --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumerTest.java @@ -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 ); + } + +} diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumerTest.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumerTest.xml new file mode 100644 index 000000000..376664603 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumerTest.xml @@ -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> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-api/2.4.4/test-project-api-2.4.4.pom b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-api/2.4.4/test-project-api-2.4.4.pom new file mode 100644 index 000000000..fa0c87e5c --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-api/2.4.4/test-project-api-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-broker-ejb/2.4.4/test-project-broker-ejb-2.4.4.pom b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-broker-ejb/2.4.4/test-project-broker-ejb-2.4.4.pom new file mode 100644 index 000000000..b333a52d2 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-broker-ejb/2.4.4/test-project-broker-ejb-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-broker-pom/2.4.4/test-project-broker-pom-2.4.4.pom b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-broker-pom/2.4.4/test-project-broker-pom-2.4.4.pom new file mode 100644 index 000000000..fd5473630 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-broker-pom/2.4.4/test-project-broker-pom-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-common/2.4.4/test-project-common-2.4.4.pom b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-common/2.4.4/test-project-common-2.4.4.pom new file mode 100644 index 000000000..d47958b23 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-common/2.4.4/test-project-common-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-endpoint-ejb/2.4.4/test-project-endpoint-ejb-2.4.4.pom b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-endpoint-ejb/2.4.4/test-project-endpoint-ejb-2.4.4.pom new file mode 100644 index 000000000..582f1e5e1 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-endpoint-ejb/2.4.4/test-project-endpoint-ejb-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-endpoint-pom/2.4.4/test-project-endpoint-pom-2.4.4.pom b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-endpoint-pom/2.4.4/test-project-endpoint-pom-2.4.4.pom new file mode 100644 index 000000000..ea4d6372d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project-endpoint-pom/2.4.4/test-project-endpoint-pom-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project/2.4.4/test-project-2.4.4.pom b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project/2.4.4/test-project-2.4.4.pom new file mode 100644 index 000000000..6dc471979 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/test-repo/test-project/test-project/2.4.4/test-project-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml b/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml index b7e03b5af..93912f688 100644 --- a/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml +++ b/archiva-modules/archiva-base/archiva-model/src/main/mdo/archiva-base.xml @@ -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(); } diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java index fa49e5d14..08228a5e7 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/FilenameParser.java @@ -104,7 +104,8 @@ public class FilenameParser // 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 ) ); diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java index b14b52a04..6470eaa56 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelMerge.java @@ -77,6 +77,7 @@ public class ProjectModelMerge 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 @@ public class ProjectModelMerge } Properties merged = new Properties(); + merged.putAll(mainProperties); Enumeration keys = parentProperties.propertyNames(); while ( keys.hasMoreElements() ) diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java index 24a22f90c..d1860e8c8 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilter.java @@ -100,20 +100,23 @@ public class EffectiveProjectModelFilter // 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 @@ public class EffectiveProjectModelFilter 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 ) diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java index 1c2f989ba..6c39cd3e6 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/filters/ProjectModelExpressionFilter.java @@ -104,11 +104,24 @@ public class ProjectModelExpressionFilter 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. diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java index 95aa27c6c..a46d85f4c 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java @@ -94,6 +94,8 @@ public class ProjectModel300Reader 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() diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java index 38509be26..441f63f6f 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java @@ -104,6 +104,8 @@ public class ProjectModel400Reader model.setBuildExtensions( getBuildExtensions( xml ) ); model.setRelocation( getRelocation( xml ) ); + + model.setOrigin("filesystem"); return model; } diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/expected-poms/archiva-model-effective.pom b/archiva-modules/archiva-base/archiva-repository-layer/src/test/expected-poms/archiva-model-effective.pom index 9129a9db4..37d9d112c 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/expected-poms/archiva-model-effective.pom +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/expected-poms/archiva-model-effective.pom @@ -431,6 +431,16 @@ <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> <version>1.4</version> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/expected-poms/test-project-model-effective.pom b/archiva-modules/archiva-base/archiva-repository-layer/src/test/expected-poms/test-project-model-effective.pom new file mode 100644 index 000000000..3057af98a --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/expected-poms/test-project-model-effective.pom @@ -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>
\ No newline at end of file diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java index 6da1ce21e..e1a0394fe 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/DefaultPathParserTest.java @@ -296,6 +296,15 @@ public class DefaultPathParserTest } /** + * 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 */ diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/FilenameParserTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/FilenameParserTest.java index 9b31da631..7f8238462 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/FilenameParserTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/content/FilenameParserTest.java @@ -169,6 +169,15 @@ public class FilenameParserTest 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" ); diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java index c4f04182b..c65a73772 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/filters/EffectiveProjectModelFilterTest.java @@ -81,20 +81,29 @@ public class EffectiveProjectModelFilterTest 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 @@ public class EffectiveProjectModelFilterTest while ( it.hasNext() ) { Dependency dep = it.next(); - String key = Dependency.toVersionlessKey( dep ); + String key = Dependency.toKey( dep ); map.put( key, dep ); } return map; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java index 5d6d0c3b7..735bf9b31 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400ReaderTest.java @@ -92,6 +92,6 @@ public class ProjectModel400ReaderTest 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() ); } } diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom index 52c185ea7..9c9053a3c 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/org/apache/maven/archiva/archiva-model/1.0-SNAPSHOT/archiva-model-1.0-SNAPSHOT.pom @@ -34,6 +34,16 @@ <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> </dependency> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-api/2.4.4/test-project-api-2.4.4.pom b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-api/2.4.4/test-project-api-2.4.4.pom new file mode 100644 index 000000000..fa0c87e5c --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-api/2.4.4/test-project-api-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-broker-ejb/2.4.4/test-project-broker-ejb-2.4.4.pom b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-broker-ejb/2.4.4/test-project-broker-ejb-2.4.4.pom new file mode 100644 index 000000000..b333a52d2 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-broker-ejb/2.4.4/test-project-broker-ejb-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-broker-pom/2.4.4/test-project-broker-pom-2.4.4.pom b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-broker-pom/2.4.4/test-project-broker-pom-2.4.4.pom new file mode 100644 index 000000000..fd5473630 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-broker-pom/2.4.4/test-project-broker-pom-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-common/2.4.4/test-project-common-2.4.4.pom b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-common/2.4.4/test-project-common-2.4.4.pom new file mode 100644 index 000000000..d47958b23 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-common/2.4.4/test-project-common-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-endpoint-ejb/2.4.4/test-project-endpoint-ejb-2.4.4.pom b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-endpoint-ejb/2.4.4/test-project-endpoint-ejb-2.4.4.pom new file mode 100644 index 000000000..582f1e5e1 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-endpoint-ejb/2.4.4/test-project-endpoint-ejb-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-endpoint-pom/2.4.4/test-project-endpoint-pom-2.4.4.pom b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-endpoint-pom/2.4.4/test-project-endpoint-pom-2.4.4.pom new file mode 100644 index 000000000..ea4d6372d --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project-endpoint-pom/2.4.4/test-project-endpoint-pom-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project/2.4.4/test-project-2.4.4.pom b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project/2.4.4/test-project-2.4.4.pom new file mode 100644 index 000000000..6dc471979 --- /dev/null +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/repositories/default-repository/test-project/test-project/2.4.4/test-project-2.4.4.pom @@ -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> diff --git a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/project/ProjectModelToDatabaseListener.java b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/project/ProjectModelToDatabaseListener.java index 04f3a23c7..2e636197e 100644 --- a/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/project/ProjectModelToDatabaseListener.java +++ b/archiva-modules/archiva-database/src/main/java/org/apache/maven/archiva/database/project/ProjectModelToDatabaseListener.java @@ -24,6 +24,7 @@ import java.util.List; 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 class ProjectModelToDatabaseListener 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 { |