From a6c9464436d9667324436fcb965bc1fde9e23ef5 Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Sat, 11 Oct 2008 03:56:18 +0000 Subject: [PATCH] [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 --- .../archiva/common/utils/VersionUtil.java | 2 +- .../ProjectModelToDatabaseConsumer.java | 19 +- .../ProjectModelToDatabaseConsumerTest.java | 125 +++++++++ .../ProjectModelToDatabaseConsumerTest.xml | 86 +++++++ .../2.4.4/test-project-api-2.4.4.pom | 39 +++ .../2.4.4/test-project-broker-ejb-2.4.4.pom | 77 ++++++ .../2.4.4/test-project-broker-pom-2.4.4.pom | 16 ++ .../2.4.4/test-project-common-2.4.4.pom | 119 +++++++++ .../2.4.4/test-project-endpoint-ejb-2.4.4.pom | 75 ++++++ .../2.4.4/test-project-endpoint-pom-2.4.4.pom | 16 ++ .../test-project/2.4.4/test-project-2.4.4.pom | 161 ++++++++++++ .../src/main/mdo/archiva-base.xml | 4 +- .../repository/content/FilenameParser.java | 3 +- .../repository/project/ProjectModelMerge.java | 2 + .../filters/EffectiveProjectModelFilter.java | 13 +- .../filters/ProjectModelExpressionFilter.java | 13 + .../readers/ProjectModel300Reader.java | 2 + .../readers/ProjectModel400Reader.java | 2 + .../expected-poms/archiva-model-effective.pom | 10 + .../test-project-model-effective.pom | 243 ++++++++++++++++++ .../content/DefaultPathParserTest.java | 9 + .../content/FilenameParserTest.java | 9 + .../EffectiveProjectModelFilterTest.java | 19 +- .../readers/ProjectModel400ReaderTest.java | 2 +- .../archiva-model-1.0-SNAPSHOT.pom | 10 + .../2.4.4/test-project-api-2.4.4.pom | 39 +++ .../2.4.4/test-project-broker-ejb-2.4.4.pom | 77 ++++++ .../2.4.4/test-project-broker-pom-2.4.4.pom | 16 ++ .../2.4.4/test-project-common-2.4.4.pom | 119 +++++++++ .../2.4.4/test-project-endpoint-ejb-2.4.4.pom | 75 ++++++ .../2.4.4/test-project-endpoint-pom-2.4.4.pom | 16 ++ .../test-project/2.4.4/test-project-2.4.4.pom | 161 ++++++++++++ .../ProjectModelToDatabaseListener.java | 5 +- 33 files changed, 1555 insertions(+), 29 deletions(-) create mode 100644 archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumerTest.java create mode 100644 archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/test/resources/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumerTest.xml create mode 100644 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 create mode 100644 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 create mode 100644 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 create mode 100644 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 create mode 100644 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 create mode 100644 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 create mode 100644 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 create mode 100644 archiva-modules/archiva-base/archiva-repository-layer/src/test/expected-poms/test-project-model-effective.pom create mode 100644 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 create mode 100644 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 create mode 100644 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 create mode 100644 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 create mode 100644 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 create mode 100644 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 create mode 100644 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 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; @@ -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 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 Michal Stochmialek + */ +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 @@ + + + + + + + + org.apache.maven.archiva.database.jdo.JdoAccess + archiva + org.apache.maven.archiva.database.jdo.JdoAccess + + + org.codehaus.plexus.jdo.JdoFactory + archiva + + + + + + + org.codehaus.plexus.jdo.JdoFactory + archiva + org.codehaus.plexus.jdo.DefaultConfigurableJdoFactory + + + + org.hsqldb.jdbcDriver + jdbc:hsqldb:mem:TESTDB + sa + + + + org.jpox.PersistenceManagerFactoryImpl + + + javax.jdo.PersistenceManagerFactoryClass + org.jpox.PersistenceManagerFactoryImpl + + + org.jpox.autoCreateSchema + true + + + + + + + org.codehaus.plexus.cache.Cache + effective-project-cache + org.codehaus.plexus.cache.ehcache.EhcacheCache + Effective Project Cache + + 600 + true + ${java.io.tmpdir}/archiva/effectiveproject + true + 1000 + LRU + effective-project-cache + false + + + 2700 + + 1800 + + + + 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 @@ + + + 4.0.0 + + test-project + test-project + 2.4.4 + + test-project + test-project-api + Test Project API + + + + javax.activation + activation + + + stax + stax-api + + + + + + + maven-source-plugin + + + package + + jar + + + + + + + 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 @@ + + + 4.0.0 + + test-project + test-project-broker-pom + 2.4.4 + + test-project-broker-ejb + Test Project Broker EJB + ejb + + + + test-project + test-project-common + test-jar + ${pom.version} + test + + + test-project + test-project-common + ${pom.version} + + + test-project + test-project-api + ${pom.version} + + + commons-httpclient + commons-httpclient + + + commons-id + commons-id + + + commons-discovery + commons-discovery + + + commons-logging + commons-logging + + + log4j + log4j + + + org.springframework + spring-mock + + + javax.jms + jms + + + javax.servlet + servlet-api + + + javax.activation + activation + + + javax.mail + mail + + + javax.management + jmxri + + + + 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 @@ + + + 4.0.0 + + test-project + test-project + 2.4.4 + + test-project-broker-pom + Test Project Broker POM + pom + + + broker-ejb + + 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 @@ + + + 4.0.0 + + test-project + test-project + 2.4.4 + + test-project + test-project-common + Test Project Commons + + + test-project + test-project-api + ${pom.version} + + + commons-id + commons-id + + + commons-discovery + commons-discovery + + + org.springframework + spring + + + commons-lang + commons-lang + + + commons-collections + commons-collections + + + commons-logging + commons-logging + + + commons-httpclient + commons-httpclient + + + log4j + log4j + + + stax + stax-api + + + org.codehaus.woodstox + wstx-asl + + + org.codehaus.castor + castor + + + xerces + xerces + + + javax.activation + activation + + + javax.jms + jms + + + javax.ejb + ejb + + + javax.servlet + servlet-api + + + javax.mail + mail + + + javax.management + jmxri + + + + + + + + maven-source-plugin + + + package + + jar + + + + + + maven-jar-plugin + + + package + + test-jar + + + + + + + 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 @@ + + + 4.0.0 + + test-project + test-project-endpoint-pom + 2.4.4 + + test-project + test-project-endpoint-ejb + Test Project Endpoint EJB + ejb + + + + test-project + test-project-common + ${pom.version} + + + test-project + test-project-api + ${pom.version} + + + + test-project + test-project-common + ${pom.version} + test-jar + test + + + commons-id + commons-id + + + commons-discovery + commons-discovery + + + commons-logging + commons-logging + + + log4j + log4j + + + javax.jms + jms + + + javax.activation + activation + + + javax.mail + mail + + + xml-apis + xml-apis + + + javax.management + jmxri + + + javax.servlet + servlet-api + + + + 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 @@ + + + 4.0.0 + + test-project + test-project + 2.4.4 + + test-project-endpoint-pom + Test Project Endpoint POM + pom + + + endpoint-ejb + + 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 @@ + + + 4.0.0 + + test-project + test-project + Test Project + 2.4.4 + pom + + + Company + http://www.company.com/ + + 2002 + + + api + common + broker + endpoint + + + + + junit + junit + 3.8.1 + test + + + + + + + javax.activation + activation + 1.0.2 + provided + + + javax.jms + jms + 1.0.2 + provided + + + javax.ejb + ejb + 2.0 + provided + + + javax.servlet + servlet-api + 2.4 + provided + + + javax.mail + mail + 1.4 + provided + + + xml-apis + xml-apis + 2.0.2 + provided + + + commons-logging + commons-logging + 1.0.4 + + + commons-lang + commons-lang + 2.1 + + + commons-collections + commons-collections + 3.2 + + + org.springframework + spring + 2.0.7 + + + org.springframework + spring-mock + 2.0.7 + test + + + org.springframework + spring-jdbc + + + org.springframework + spring-web + + + + + log4j + log4j + 1.2.8 + + + commons-discovery + commons-discovery + 0.2 + + + commons-id + commons-id + 0.1-dev + + + org.codehaus.castor + castor + 1.0.5-xml + + + xerces + xerces + 2.4.0 + + + commons-httpclient + commons-httpclient + 3.1 + + + stax + stax-api + 1.0.1 + + + org.codehaus.woodstox + wstx-asl + 3.2.1 + + + com.thoughtworks.xstream + xstream + 1.2.2 + + + javax.management + jmxri + 1.2.1 + provided + + + + + 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 3 / 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 @@ -430,6 +430,16 @@ archiva-common 1.0-SNAPSHOT + + org.apache.maven.archiva + archiva-test-A + 1.0-SNAPSHOT + + + org.apache.maven.archiva + archiva-test-B + 1.0-SNAPSHOT + org.codehaus.plexus plexus-utils 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 @@ + + + + + + + + + + + + + + + + + + test-project-endpoint-pom + test-project + 2.4.4 + + 4.0.0 + test-project + test-project-endpoint-ejb + ejb + Test Project Endpoint EJB + 2.4.4 + 2002 + + Company + http://www.company.com/ + + + + junit + junit + 3.8.1 + test + + + test-project + test-project-common + 2.4.4 + + + test-project + test-project-api + 2.4.4 + + + test-project + test-project-common + 2.4.4 + test-jar + test + + + commons-id + commons-id + 0.1-dev + + + commons-discovery + commons-discovery + 0.2 + + + commons-logging + commons-logging + 1.0.4 + + + log4j + log4j + 1.2.8 + + + javax.jms + jms + 1.0.2 + provided + + + javax.activation + activation + 1.0.2 + provided + + + javax.mail + mail + 1.4 + provided + + + xml-apis + xml-apis + 2.0.2 + provided + + + javax.management + jmxri + 1.2.1 + provided + + + javax.servlet + servlet-api + 2.4 + provided + + + + + + + + javax.activation + activation + 1.0.2 + provided + + + javax.jms + jms + 1.0.2 + provided + + + javax.ejb + ejb + 2.0 + provided + + + javax.servlet + servlet-api + 2.4 + provided + + + javax.mail + mail + 1.4 + provided + + + xml-apis + xml-apis + 2.0.2 + provided + + + commons-logging + commons-logging + 1.0.4 + + + commons-lang + commons-lang + 2.1 + + + commons-collections + commons-collections + 3.2 + + + org.springframework + spring + 2.0.7 + + + org.springframework + spring-mock + 2.0.7 + test + + + spring-jdbc + org.springframework + + + spring-web + org.springframework + + + + + log4j + log4j + 1.2.8 + + + commons-discovery + commons-discovery + 0.2 + + + commons-id + commons-id + 0.1-dev + + + org.codehaus.castor + castor + 1.0.5-xml + + + xerces + xerces + 2.4.0 + + + commons-httpclient + commons-httpclient + 3.1 + + + stax + stax-api + 1.0.1 + + + org.codehaus.woodstox + wstx-asl + 3.2.1 + + + com.thoughtworks.xstream + xstream + 1.2.2 + + + javax.management + jmxri + 1.2.1 + provided + + + + \ 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 @@ -295,6 +295,15 @@ public class DefaultPathParserTest 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 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 @@ -33,6 +33,16 @@ org.apache.maven.archiva archiva-common + + org.apache.maven.archiva + archiva-test-A + ${pom.version} + + + org.apache.maven.archiva + archiva-test-B + ${parent.version} + org.codehaus.plexus plexus-utils 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 @@ + + + 4.0.0 + + test-project + test-project + 2.4.4 + + test-project + test-project-api + Test Project API + + + + javax.activation + activation + + + stax + stax-api + + + + + + + maven-source-plugin + + + package + + jar + + + + + + + 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 @@ + + + 4.0.0 + + test-project + test-project-broker-pom + 2.4.4 + + test-project-broker-ejb + Test Project Broker EJB + ejb + + + + test-project + test-project-common + test-jar + ${pom.version} + test + + + test-project + test-project-common + ${pom.version} + + + test-project + test-project-api + ${pom.version} + + + commons-httpclient + commons-httpclient + + + commons-id + commons-id + + + commons-discovery + commons-discovery + + + commons-logging + commons-logging + + + log4j + log4j + + + org.springframework + spring-mock + + + javax.jms + jms + + + javax.servlet + servlet-api + + + javax.activation + activation + + + javax.mail + mail + + + javax.management + jmxri + + + + 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 @@ + + + 4.0.0 + + test-project + test-project + 2.4.4 + + test-project-broker-pom + Test Project Broker POM + pom + + + broker-ejb + + 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 @@ + + + 4.0.0 + + test-project + test-project + 2.4.4 + + test-project + test-project-common + Test Project Commons + + + test-project + test-project-api + ${pom.version} + + + commons-id + commons-id + + + commons-discovery + commons-discovery + + + org.springframework + spring + + + commons-lang + commons-lang + + + commons-collections + commons-collections + + + commons-logging + commons-logging + + + commons-httpclient + commons-httpclient + + + log4j + log4j + + + stax + stax-api + + + org.codehaus.woodstox + wstx-asl + + + org.codehaus.castor + castor + + + xerces + xerces + + + javax.activation + activation + + + javax.jms + jms + + + javax.ejb + ejb + + + javax.servlet + servlet-api + + + javax.mail + mail + + + javax.management + jmxri + + + + + + + + maven-source-plugin + + + package + + jar + + + + + + maven-jar-plugin + + + package + + test-jar + + + + + + + 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 @@ + + + 4.0.0 + + test-project + test-project-endpoint-pom + 2.4.4 + + test-project + test-project-endpoint-ejb + Test Project Endpoint EJB + ejb + + + + test-project + test-project-common + ${pom.version} + + + test-project + test-project-api + ${pom.version} + + + + test-project + test-project-common + ${pom.version} + test-jar + test + + + commons-id + commons-id + + + commons-discovery + commons-discovery + + + commons-logging + commons-logging + + + log4j + log4j + + + javax.jms + jms + + + javax.activation + activation + + + javax.mail + mail + + + xml-apis + xml-apis + + + javax.management + jmxri + + + javax.servlet + servlet-api + + + + 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 @@ + + + 4.0.0 + + test-project + test-project + 2.4.4 + + test-project-endpoint-pom + Test Project Endpoint POM + pom + + + endpoint-ejb + + 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 @@ + + + 4.0.0 + + test-project + test-project + Test Project + 2.4.4 + pom + + + Company + http://www.company.com/ + + 2002 + + + api + common + broker + endpoint + + + + + junit + junit + 3.8.1 + test + + + + + + + javax.activation + activation + 1.0.2 + provided + + + javax.jms + jms + 1.0.2 + provided + + + javax.ejb + ejb + 2.0 + provided + + + javax.servlet + servlet-api + 2.4 + provided + + + javax.mail + mail + 1.4 + provided + + + xml-apis + xml-apis + 2.0.2 + provided + + + commons-logging + commons-logging + 1.0.4 + + + commons-lang + commons-lang + 2.1 + + + commons-collections + commons-collections + 3.2 + + + org.springframework + spring + 2.0.7 + + + org.springframework + spring-mock + 2.0.7 + test + + + org.springframework + spring-jdbc + + + org.springframework + spring-web + + + + + log4j + log4j + 1.2.8 + + + commons-discovery + commons-discovery + 0.2 + + + commons-id + commons-id + 0.1-dev + + + org.codehaus.castor + castor + 1.0.5-xml + + + xerces + xerces + 2.4.0 + + + commons-httpclient + commons-httpclient + 3.1 + + + stax + stax-api + 1.0.1 + + + org.codehaus.woodstox + wstx-asl + 3.2.1 + + + com.thoughtworks.xstream + xstream + 1.2.2 + + + javax.management + jmxri + 1.2.1 + provided + + + + + 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 { -- 2.39.5