o proxy parent POM if not found in the repo when building the effective POM when creating metadata (also applied the same in dependency tree builder) o added unit tests o moved out wagonfactory classes into separate module so it can be used by maven2-repository w/o depending on archiva-proxy module (as it inroduces cyclic dependency) git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1135978 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.4-M1
<artifactId>sisu-inject-plexus</artifactId> | <artifactId>sisu-inject-plexus</artifactId> | ||||
<scope>compile</scope> | <scope>compile</scope> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>dom4j</groupId> | |||||
<artifactId>dom4j</artifactId> | |||||
<version>1.6.1</version> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | <dependency> | ||||
<groupId>org.sonatype.nexus</groupId> | <groupId>org.sonatype.nexus</groupId> | ||||
<artifactId>nexus-indexer</artifactId> | <artifactId>nexus-indexer</artifactId> | ||||
<groupId>javax.inject</groupId> | <groupId>javax.inject</groupId> | ||||
<artifactId>javax.inject</artifactId> | <artifactId>javax.inject</artifactId> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>dom4j</groupId> | |||||
<artifactId>dom4j</artifactId> | |||||
<version>1.6.1</version> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
</project> | </project> |
package org.apache.maven.archiva.common.utils; | |||||
/* | |||||
* 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; | |||||
public class FileUtil | |||||
{ | |||||
public static String getBasedir() | |||||
{ | |||||
String basedir = System.getProperty( "basedir" ); | |||||
if ( basedir == null ) | |||||
{ | |||||
basedir = new File( "" ).getAbsolutePath(); | |||||
} | |||||
return basedir; | |||||
} | |||||
} |
java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap = | java.util.Map<String, java.util.List<ProxyConnectorConfiguration>> proxyConnectorMap = | ||||
new java.util.HashMap<String, java.util.List<ProxyConnectorConfiguration>>(); | new java.util.HashMap<String, java.util.List<ProxyConnectorConfiguration>>(); | ||||
java.util.Iterator<ProxyConnectorConfiguration> it = proxyConnectors.iterator(); | |||||
while ( it.hasNext() ) | |||||
if( proxyConnectors != null ) | |||||
{ | { | ||||
ProxyConnectorConfiguration proxyConfig = it.next(); | |||||
String key = proxyConfig.getSourceRepoId(); | |||||
java.util.List<ProxyConnectorConfiguration> connectors = proxyConnectorMap.get( key ); | |||||
if ( connectors == null ) | |||||
java.util.Iterator<ProxyConnectorConfiguration> it = proxyConnectors.iterator(); | |||||
while ( it.hasNext() ) | |||||
{ | { | ||||
connectors = new java.util.ArrayList<ProxyConnectorConfiguration>(); | |||||
proxyConnectorMap.put( key, connectors ); | |||||
} | |||||
ProxyConnectorConfiguration proxyConfig = it.next(); | |||||
String key = proxyConfig.getSourceRepoId(); | |||||
java.util.List<ProxyConnectorConfiguration> connectors = proxyConnectorMap.get( key ); | |||||
if ( connectors == null ) | |||||
{ | |||||
connectors = new java.util.ArrayList<ProxyConnectorConfiguration>(); | |||||
proxyConnectorMap.put( key, connectors ); | |||||
} | |||||
connectors.add( proxyConfig ); | |||||
java.util.Collections.sort( connectors, | |||||
org.apache.maven.archiva.configuration.functors.ProxyConnectorConfigurationOrderComparator.getInstance() ); | |||||
connectors.add( proxyConfig ); | |||||
java.util.Collections.sort( connectors, | |||||
org.apache.maven.archiva.configuration.functors.ProxyConnectorConfigurationOrderComparator.getInstance() ); | |||||
} | |||||
} | } | ||||
return proxyConnectorMap; | return proxyConnectorMap; |
<?xml version="1.0"?> | |||||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | |||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |||||
<modelVersion>4.0.0</modelVersion> | |||||
<parent> | |||||
<artifactId>archiva-base</artifactId> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<version>1.4-SNAPSHOT</version> | |||||
</parent> | |||||
<artifactId>archiva-proxy-common</artifactId> | |||||
<name>Archiva Base :: Proxy Common</name> | |||||
<properties> | |||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |||||
</properties> | |||||
<dependencies> | |||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-plexus-bridge</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.maven.wagon</groupId> | |||||
<artifactId>wagon-provider-api</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.maven.wagon</groupId> | |||||
<artifactId>wagon-file</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.maven.wagon</groupId> | |||||
<artifactId>wagon-http-lightweight</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>commons-logging</groupId> | |||||
<artifactId>commons-logging-api</artifactId> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.springframework</groupId> | |||||
<artifactId>spring-test</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
</dependencies> | |||||
</project> |
package org.apache.maven.archiva.proxy; | |||||
package org.apache.archiva.proxy.common; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one |
package org.apache.maven.archiva.proxy; | |||||
package org.apache.archiva.proxy.common; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one |
package org.apache.maven.archiva.proxy; | |||||
package org.apache.archiva.proxy.common; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!-- | |||||
~ 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. | |||||
--> | |||||
<beans xmlns="http://www.springframework.org/schema/beans" | |||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
xmlns:context="http://www.springframework.org/schema/context" | |||||
xsi:schemaLocation="http://www.springframework.org/schema/beans | |||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | |||||
http://www.springframework.org/schema/context | |||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd" | |||||
default-lazy-init="true"> | |||||
<context:annotation-config/> | |||||
<context:component-scan base-package="org.apache.archiva.proxy.common"/> | |||||
</beans> |
package org.apache.maven.archiva.proxy; | |||||
package org.apache.archiva.proxy.common; | |||||
/* | /* | ||||
* Licensed to the Apache Software Foundation (ASF) under one | * Licensed to the Apache Software Foundation (ASF) under one | ||||
*/ | */ | ||||
import junit.framework.TestCase; | import junit.framework.TestCase; | ||||
import org.apache.archiva.common.plexusbridge.PlexusSisuBridge; | |||||
import org.apache.maven.wagon.Wagon; | import org.apache.maven.wagon.Wagon; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.junit.runner.RunWith; | import org.junit.runner.RunWith; | ||||
* | * | ||||
*/ | */ | ||||
@RunWith( SpringJUnit4ClassRunner.class ) | @RunWith( SpringJUnit4ClassRunner.class ) | ||||
@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml","classpath:/spring-context.xml"} ) | |||||
@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml" } ) | |||||
public class WagonFactoryTest | public class WagonFactoryTest | ||||
extends TestCase | extends TestCase | ||||
{ | { |
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!-- | |||||
~ 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. | |||||
--> | |||||
<beans xmlns="http://www.springframework.org/schema/beans" | |||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
xmlns:context="http://www.springframework.org/schema/context" | |||||
xsi:schemaLocation="http://www.springframework.org/schema/beans | |||||
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd | |||||
http://www.springframework.org/schema/context | |||||
http://www.springframework.org/schema/context/spring-context-3.0.xsd" | |||||
default-lazy-init="true"> | |||||
</beans> |
<groupId>org.apache.archiva</groupId> | <groupId>org.apache.archiva</groupId> | ||||
<artifactId>archiva-scheduler-repository</artifactId> | <artifactId>archiva-scheduler-repository</artifactId> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-proxy-common</artifactId> | |||||
</dependency> | |||||
<dependency> | <dependency> | ||||
<groupId>commons-io</groupId> | <groupId>commons-io</groupId> | ||||
<artifactId>commons-io</artifactId> | <artifactId>commons-io</artifactId> |
*/ | */ | ||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import org.apache.archiva.proxy.common.WagonFactory; | |||||
import org.apache.archiva.proxy.common.WagonFactoryException; | |||||
import org.apache.archiva.scheduler.ArchivaTaskScheduler; | import org.apache.archiva.scheduler.ArchivaTaskScheduler; | ||||
import org.apache.archiva.scheduler.repository.RepositoryTask; | import org.apache.archiva.scheduler.repository.RepositoryTask; | ||||
import org.apache.commons.collections.CollectionUtils; | import org.apache.commons.collections.CollectionUtils; |
<field-name>archivaConfiguration</field-name> | <field-name>archivaConfiguration</field-name> | ||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.proxy.WagonFactory</role> | |||||
<role>org.apache.archiva.proxy.common.WagonFactory</role> | |||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> | <role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> |
<field-name>archivaConfiguration</field-name> | <field-name>archivaConfiguration</field-name> | ||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.proxy.WagonFactory</role> | |||||
<role>org.apache.archiva.proxy.common.WagonFactory</role> | |||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> | <role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> |
<field-name>archivaConfiguration</field-name> | <field-name>archivaConfiguration</field-name> | ||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.proxy.WagonFactory</role> | |||||
<role>org.apache.archiva.proxy.common.WagonFactory</role> | |||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> | <role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> |
<field-name>urlFailureCache</field-name> | <field-name>urlFailureCache</field-name> | ||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.proxy.WagonFactory</role> | |||||
<role>org.apache.archiva.proxy.common.WagonFactory</role> | |||||
<role-hint>default</role-hint> | <role-hint>default</role-hint> | ||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> |
<field-name>archivaConfiguration</field-name> | <field-name>archivaConfiguration</field-name> | ||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.proxy.WagonFactory</role> | |||||
<role>org.apache.archiva.proxy.common.WagonFactory</role> | |||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> | <role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> |
<field-name>archivaConfiguration</field-name> | <field-name>archivaConfiguration</field-name> | ||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.proxy.WagonFactory</role> | |||||
<role>org.apache.archiva.proxy.common.WagonFactory</role> | |||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> | <role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> |
<field-name>archivaConfiguration</field-name> | <field-name>archivaConfiguration</field-name> | ||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.proxy.WagonFactory</role> | |||||
<role>org.apache.archiva.proxy.common.WagonFactory</role> | |||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> | <role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> |
<field-name>archivaConfiguration</field-name> | <field-name>archivaConfiguration</field-name> | ||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.proxy.WagonFactory</role> | |||||
<role>org.apache.archiva.proxy.common.WagonFactory</role> | |||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> | <role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> |
<field-name>archivaConfiguration</field-name> | <field-name>archivaConfiguration</field-name> | ||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.proxy.WagonFactory</role> | |||||
<role>org.apache.archiva.proxy.common.WagonFactory</role> | |||||
</requirement> | </requirement> | ||||
<requirement> | <requirement> | ||||
<role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> | <role>org.apache.maven.archiva.repository.RepositoryContentFactory</role> |
~ specific language governing permissions and limitations | ~ specific language governing permissions and limitations | ||||
~ under the License. | ~ under the License. | ||||
--> | --> | ||||
<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"> | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||||
<modelVersion>4.0.0</modelVersion> | <modelVersion>4.0.0</modelVersion> | ||||
<parent> | <parent> | ||||
<module>archiva-artifact-converter</module> | <module>archiva-artifact-converter</module> | ||||
<module>archiva-converter</module> | <module>archiva-converter</module> | ||||
<module>archiva-repository-scanner</module> | <module>archiva-repository-scanner</module> | ||||
<module>archiva-proxy-common</module> | |||||
</modules> | </modules> | ||||
</project> | |||||
</project> |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||||
<modelVersion>4.0.0</modelVersion> | |||||
<parent> | |||||
<groupId>com.example.test</groupId> | |||||
<artifactId>missing-parent-pom</artifactId> | |||||
<version>1</version> | |||||
</parent> | |||||
<artifactId>missing-parent</artifactId> | |||||
<packaging>jar</packaging> | |||||
<version>1.1</version> | |||||
<name>Test Artifact :: Missing Parent POM</name> | |||||
<dependencies> | |||||
<dependency> | |||||
<groupId>junit</groupId> | |||||
<artifactId>junit</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
</dependencies> | |||||
</project> |
<groupId>org.apache.archiva</groupId> | <groupId>org.apache.archiva</groupId> | ||||
<artifactId>metadata-repository-api</artifactId> | <artifactId>metadata-repository-api</artifactId> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-proxy-common</artifactId> | |||||
</dependency> | |||||
<dependency> | <dependency> | ||||
<groupId>org.sonatype.sisu</groupId> | <groupId>org.sonatype.sisu</groupId> | ||||
<artifactId>sisu-inject-plexus</artifactId> | <artifactId>sisu-inject-plexus</artifactId> | ||||
<groupId>org.apache.archiva</groupId> | <groupId>org.apache.archiva</groupId> | ||||
<artifactId>archiva-configuration</artifactId> | <artifactId>archiva-configuration</artifactId> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.apache.maven.wagon</groupId> | |||||
<artifactId>wagon-provider-api</artifactId> | |||||
</dependency> | |||||
<!-- TODO: aim to remove this dependency --> | <!-- TODO: aim to remove this dependency --> | ||||
<dependency> | <dependency> | ||||
<groupId>org.apache.archiva</groupId> | <groupId>org.apache.archiva</groupId> | ||||
<artifactId>slf4j-simple</artifactId> | <artifactId>slf4j-simple</artifactId> | ||||
<scope>test</scope> | <scope>test</scope> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.mockito</groupId> | |||||
<artifactId>mockito-all</artifactId> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
<build> | <build> | ||||
<plugins> | <plugins> |
import org.apache.archiva.metadata.repository.RepositorySessionFactory; | import org.apache.archiva.metadata.repository.RepositorySessionFactory; | ||||
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; | import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; | ||||
import org.apache.archiva.metadata.repository.storage.maven2.RepositoryModelResolver; | import org.apache.archiva.metadata.repository.storage.maven2.RepositoryModelResolver; | ||||
import org.apache.archiva.proxy.common.WagonFactory; | |||||
import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.StringUtils; | ||||
import org.apache.maven.archiva.common.utils.Slf4JPlexusLogger; | import org.apache.maven.archiva.common.utils.Slf4JPlexusLogger; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | ||||
import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; | |||||
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; | |||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | |||||
import org.apache.maven.artifact.Artifact; | import org.apache.maven.artifact.Artifact; | ||||
import org.apache.maven.artifact.factory.ArtifactFactory; | import org.apache.maven.artifact.factory.ArtifactFactory; | ||||
import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; | import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException; | ||||
import org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor; | import org.apache.maven.shared.dependency.tree.traversal.CollectingDependencyNodeVisitor; | ||||
import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor; | import org.apache.maven.shared.dependency.tree.traversal.DependencyNodeVisitor; | ||||
import org.apache.maven.shared.dependency.tree.traversal.FilteringDependencyNodeVisitor; | import org.apache.maven.shared.dependency.tree.traversal.FilteringDependencyNodeVisitor; | ||||
import org.apache.maven.wagon.proxy.ProxyInfo; | |||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Collection; | import java.util.Collection; | ||||
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.HashMap; | |||||
import java.util.HashSet; | import java.util.HashSet; | ||||
import java.util.LinkedHashSet; | import java.util.LinkedHashSet; | ||||
import java.util.List; | import java.util.List; | ||||
@Inject | @Inject | ||||
private PlexusSisuBridge plexusSisuBridge; | private PlexusSisuBridge plexusSisuBridge; | ||||
@Inject | |||||
private WagonFactory wagonFactory; | |||||
@PostConstruct | @PostConstruct | ||||
public void initialize() | public void initialize() | ||||
throws PlexusSisuBridgeException | throws PlexusSisuBridgeException | ||||
new DependencyTreeResolutionListener( new Slf4JPlexusLogger( getClass() ) ); | new DependencyTreeResolutionListener( new Slf4JPlexusLogger( getClass() ) ); | ||||
Artifact projectArtifact = factory.createProjectArtifact( groupId, artifactId, version ); | Artifact projectArtifact = factory.createProjectArtifact( groupId, artifactId, version ); | ||||
File basedir = findArtifactInRepositories( repositoryIds, projectArtifact ); | |||||
ManagedRepositoryConfiguration repository = findArtifactInRepositories( repositoryIds, projectArtifact ); | |||||
if ( basedir == null ) | |||||
if ( repository == null ) | |||||
{ | { | ||||
// metadata could not be resolved | // metadata could not be resolved | ||||
return; | return; | ||||
} | } | ||||
File basedir = new File( repository.getLocation() ); | |||||
try | try | ||||
{ | { | ||||
Model model = | |||||
buildProject( new RepositoryModelResolver( basedir, pathTranslator ), groupId, artifactId, version ); | |||||
// MRM-1411 | |||||
List< RemoteRepositoryConfiguration > remoteRepositories = new ArrayList<RemoteRepositoryConfiguration>(); | |||||
Map<String, ProxyInfo > networkProxies = new HashMap<String, ProxyInfo>(); | |||||
Map<String, List< ProxyConnectorConfiguration >> proxyConnectorsMap = archivaConfiguration.getConfiguration().getProxyConnectorAsMap(); | |||||
List<ProxyConnectorConfiguration> proxyConnectors = proxyConnectorsMap.get( repository.getId() ); | |||||
if( proxyConnectors != null ) | |||||
{ | |||||
for( ProxyConnectorConfiguration proxyConnector : proxyConnectors ) | |||||
{ | |||||
remoteRepositories.add( archivaConfiguration.getConfiguration().findRemoteRepositoryById( proxyConnector.getTargetRepoId() ) ); | |||||
NetworkProxyConfiguration networkProxyConfig = archivaConfiguration.getConfiguration().getNetworkProxiesAsMap().get( | |||||
proxyConnector.getProxyId() ); | |||||
if( networkProxyConfig != null ) | |||||
{ | |||||
ProxyInfo proxy = new ProxyInfo(); | |||||
proxy.setType( networkProxyConfig.getProtocol() ); | |||||
proxy.setHost( networkProxyConfig.getHost() ); | |||||
proxy.setPort( networkProxyConfig.getPort() ); | |||||
proxy.setUserName( networkProxyConfig.getUsername() ); | |||||
proxy.setPassword( networkProxyConfig.getPassword() ); | |||||
// key/value: remote repo ID/proxy info | |||||
networkProxies.put( proxyConnector.getTargetRepoId(), proxy ); | |||||
} | |||||
} | |||||
} | |||||
Model model = buildProject( new RepositoryModelResolver( basedir, pathTranslator, wagonFactory, remoteRepositories, | |||||
networkProxies, repository ), groupId, artifactId, version ); | |||||
Map managedVersions = createManagedVersionMap( model ); | Map managedVersions = createManagedVersionMap( model ); | ||||
} | } | ||||
} | } | ||||
private File findArtifactInRepositories( List<String> repositoryIds, Artifact projectArtifact ) | |||||
private ManagedRepositoryConfiguration findArtifactInRepositories( List<String> repositoryIds, Artifact projectArtifact ) | |||||
{ | { | ||||
for ( String repoId : repositoryIds ) | for ( String repoId : repositoryIds ) | ||||
{ | { | ||||
if ( file.exists() ) | if ( file.exists() ) | ||||
{ | { | ||||
return repoDir; | |||||
return repositoryConfiguration; | |||||
} | } | ||||
} | } | ||||
return null; | return null; | ||||
factory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), | factory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), | ||||
artifact.getScope() ); | artifact.getScope() ); | ||||
File basedir = findArtifactInRepositories( repositoryIds, pomArtifact ); | |||||
ManagedRepositoryConfiguration repository = findArtifactInRepositories( repositoryIds, pomArtifact ); | |||||
Model project = null; | Model project = null; | ||||
if ( !Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) && basedir != null ) | |||||
if ( !Artifact.SCOPE_SYSTEM.equals( artifact.getScope() ) && repository != null ) | |||||
{ | { | ||||
File basedir = new File( repository.getLocation() ); | |||||
try | try | ||||
{ | { | ||||
project = | project = |
import org.apache.archiva.metadata.repository.storage.RepositoryStorage; | import org.apache.archiva.metadata.repository.storage.RepositoryStorage; | ||||
import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException; | import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException; | ||||
import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; | import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; | ||||
import org.apache.archiva.proxy.common.WagonFactory; | |||||
import org.apache.maven.archiva.common.utils.VersionUtil; | import org.apache.maven.archiva.common.utils.VersionUtil; | ||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | ||||
import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; | |||||
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; | |||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | |||||
import org.apache.maven.archiva.xml.XMLException; | import org.apache.maven.archiva.xml.XMLException; | ||||
import org.apache.maven.model.CiManagement; | import org.apache.maven.model.CiManagement; | ||||
import org.apache.maven.model.Dependency; | import org.apache.maven.model.Dependency; | ||||
import org.apache.maven.model.building.ModelBuilder; | import org.apache.maven.model.building.ModelBuilder; | ||||
import org.apache.maven.model.building.ModelBuildingException; | import org.apache.maven.model.building.ModelBuildingException; | ||||
import org.apache.maven.model.building.ModelBuildingRequest; | import org.apache.maven.model.building.ModelBuildingRequest; | ||||
import org.apache.maven.model.building.ModelProblem; | |||||
import org.apache.maven.wagon.proxy.ProxyInfo; | |||||
import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import javax.inject.Inject; | import javax.inject.Inject; | ||||
import javax.inject.Named; | import javax.inject.Named; | ||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileNotFoundException; | |||||
import java.io.FilenameFilter; | import java.io.FilenameFilter; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Collection; | import java.util.Collection; | ||||
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.Date; | import java.util.Date; | ||||
import java.util.HashMap; | |||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | |||||
/** | /** | ||||
* Maven 2 repository format storage implementation. This class currently takes parameters to indicate the repository to | * Maven 2 repository format storage implementation. This class currently takes parameters to indicate the repository to | ||||
@Named( value = "repositoryPathTranslator#maven2" ) | @Named( value = "repositoryPathTranslator#maven2" ) | ||||
private RepositoryPathTranslator pathTranslator; | private RepositoryPathTranslator pathTranslator; | ||||
@Inject | |||||
private WagonFactory wagonFactory; | |||||
private final static Logger log = LoggerFactory.getLogger( Maven2RepositoryStorage.class ); | private final static Logger log = LoggerFactory.getLogger( Maven2RepositoryStorage.class ); | ||||
private static final String METADATA_FILENAME = "maven-metadata.xml"; | private static final String METADATA_FILENAME = "maven-metadata.xml"; | ||||
"The artifact's POM file '" + file.getAbsolutePath() + "' was missing" ); | "The artifact's POM file '" + file.getAbsolutePath() + "' was missing" ); | ||||
} | } | ||||
List<RemoteRepositoryConfiguration> remoteRepositories = new ArrayList<RemoteRepositoryConfiguration>(); | |||||
Map<String, ProxyInfo> networkProxies = new HashMap<String, ProxyInfo>(); | |||||
Map<String, List<ProxyConnectorConfiguration>> proxyConnectorsMap = archivaConfiguration.getConfiguration().getProxyConnectorAsMap(); | |||||
List<ProxyConnectorConfiguration> proxyConnectors = proxyConnectorsMap.get( repoId ); | |||||
if( proxyConnectors != null ) | |||||
{ | |||||
for( ProxyConnectorConfiguration proxyConnector : proxyConnectors ) | |||||
{ | |||||
RemoteRepositoryConfiguration remoteRepoConfig = archivaConfiguration.getConfiguration().findRemoteRepositoryById( | |||||
proxyConnector.getTargetRepoId() ); | |||||
if( remoteRepoConfig != null ) | |||||
{ | |||||
remoteRepositories.add( remoteRepoConfig ); | |||||
NetworkProxyConfiguration networkProxyConfig = archivaConfiguration.getConfiguration().getNetworkProxiesAsMap().get( | |||||
proxyConnector.getProxyId() ); | |||||
if( networkProxyConfig != null ) | |||||
{ | |||||
ProxyInfo proxy = new ProxyInfo(); | |||||
proxy.setType( networkProxyConfig.getProtocol() ); | |||||
proxy.setHost( networkProxyConfig.getHost() ); | |||||
proxy.setPort( networkProxyConfig.getPort() ); | |||||
proxy.setUserName( networkProxyConfig.getUsername() ); | |||||
proxy.setPassword( networkProxyConfig.getPassword() ); | |||||
// key/value: remote repo ID/proxy info | |||||
networkProxies.put( proxyConnector.getTargetRepoId(), proxy ); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
ModelBuildingRequest req = new DefaultModelBuildingRequest(); | ModelBuildingRequest req = new DefaultModelBuildingRequest(); | ||||
req.setProcessPlugins( false ); | req.setProcessPlugins( false ); | ||||
req.setPomFile( file ); | req.setPomFile( file ); | ||||
req.setModelResolver( new RepositoryModelResolver( basedir, pathTranslator ) ); | |||||
// MRM-1411 | |||||
req.setModelResolver( new RepositoryModelResolver( basedir, pathTranslator, wagonFactory, remoteRepositories, | |||||
networkProxies, repositoryConfiguration ) ); | |||||
req.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); | req.setValidationLevel( ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL ); | ||||
Model model; | Model model; | ||||
{ | { | ||||
String msg = "The artifact's POM file '" + file + "' was invalid: " + e.getMessage(); | String msg = "The artifact's POM file '" + file + "' was invalid: " + e.getMessage(); | ||||
List<ModelProblem> modelProblems = e.getProblems(); | |||||
for( ModelProblem problem : modelProblems ) | |||||
{ | |||||
// MRM-1411, related to MRM-1335 | |||||
// this means that the problem was that the parent wasn't resolved! | |||||
if( problem.getException() instanceof FileNotFoundException && e.getModelId() != null && | |||||
!e.getModelId().equals( problem.getModelId() ) ) | |||||
{ | |||||
log.warn( "The artifact's parent POM file '" + file + "' cannot be resolved. " + | |||||
"Using defaults for project version metadata.." ); | |||||
ProjectVersionMetadata metadata = new ProjectVersionMetadata(); | |||||
metadata.setId( projectVersion ); | |||||
MavenProjectFacet facet = new MavenProjectFacet(); | |||||
facet.setGroupId( namespace ); | |||||
facet.setArtifactId( projectId ); | |||||
facet.setPackaging( "jar" ); | |||||
metadata.addFacet( facet ); | |||||
return metadata; | |||||
} | |||||
} | |||||
throw new RepositoryStorageMetadataInvalidException( "invalid-pom", msg, e ); | throw new RepositoryStorageMetadataInvalidException( "invalid-pom", msg, e ); | ||||
} | } | ||||
return metadata; | return metadata; | ||||
} | } | ||||
public void setWagonFactory( WagonFactory wagonFactory ) | |||||
{ | |||||
this.wagonFactory = wagonFactory; | |||||
} | |||||
private List<org.apache.archiva.metadata.model.Dependency> convertDependencies( List<Dependency> dependencies ) | private List<org.apache.archiva.metadata.model.Dependency> convertDependencies( List<Dependency> dependencies ) | ||||
{ | { | ||||
List<org.apache.archiva.metadata.model.Dependency> l = | List<org.apache.archiva.metadata.model.Dependency> l = |
*/ | */ | ||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; | import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; | ||||
import org.apache.archiva.proxy.common.WagonFactory; | |||||
import org.apache.archiva.proxy.common.WagonFactoryException; | |||||
import org.apache.commons.io.FileUtils; | |||||
import org.apache.commons.lang.StringUtils; | |||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | |||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | |||||
import org.apache.maven.model.Repository; | import org.apache.maven.model.Repository; | ||||
import org.apache.maven.model.building.FileModelSource; | import org.apache.maven.model.building.FileModelSource; | ||||
import org.apache.maven.model.building.ModelSource; | import org.apache.maven.model.building.ModelSource; | ||||
import org.apache.maven.model.resolution.InvalidRepositoryException; | import org.apache.maven.model.resolution.InvalidRepositoryException; | ||||
import org.apache.maven.model.resolution.ModelResolver; | import org.apache.maven.model.resolution.ModelResolver; | ||||
import org.apache.maven.model.resolution.UnresolvableModelException; | import org.apache.maven.model.resolution.UnresolvableModelException; | ||||
import org.apache.maven.wagon.ConnectionException; | |||||
import org.apache.maven.wagon.ResourceDoesNotExistException; | |||||
import org.apache.maven.wagon.TransferFailedException; | |||||
import org.apache.maven.wagon.Wagon; | |||||
import org.apache.maven.wagon.authentication.AuthenticationException; | |||||
import org.apache.maven.wagon.authentication.AuthenticationInfo; | |||||
import org.apache.maven.wagon.authorization.AuthorizationException; | |||||
import org.apache.maven.wagon.proxy.ProxyInfo; | |||||
import org.slf4j.Logger; | |||||
import org.slf4j.LoggerFactory; | |||||
public class RepositoryModelResolver | public class RepositoryModelResolver | ||||
implements ModelResolver | implements ModelResolver | ||||
private RepositoryPathTranslator pathTranslator; | private RepositoryPathTranslator pathTranslator; | ||||
private WagonFactory wagonFactory; | |||||
private List<RemoteRepositoryConfiguration> remoteRepositories; | |||||
private ManagedRepositoryConfiguration targetRepository; | |||||
private static final Logger log = LoggerFactory.getLogger( RepositoryModelResolver.class ); | |||||
// key/value: remote repo ID/network proxy | |||||
Map<String, ProxyInfo> networkProxyMap; | |||||
public RepositoryModelResolver( File basedir, RepositoryPathTranslator pathTranslator ) | public RepositoryModelResolver( File basedir, RepositoryPathTranslator pathTranslator ) | ||||
{ | { | ||||
this.basedir = basedir; | this.basedir = basedir; | ||||
this.pathTranslator = pathTranslator; | this.pathTranslator = pathTranslator; | ||||
} | } | ||||
public RepositoryModelResolver( File basedir, RepositoryPathTranslator pathTranslator, | |||||
WagonFactory wagonFactory, List<RemoteRepositoryConfiguration> remoteRepositories, | |||||
Map<String, ProxyInfo> networkProxiesMap, ManagedRepositoryConfiguration targetRepository ) | |||||
{ | |||||
this( basedir, pathTranslator ); | |||||
this.wagonFactory = wagonFactory; | |||||
this.remoteRepositories = remoteRepositories; | |||||
this.networkProxyMap = networkProxiesMap; | |||||
this.targetRepository = targetRepository; | |||||
} | |||||
public ModelSource resolveModel( String groupId, String artifactId, String version ) | public ModelSource resolveModel( String groupId, String artifactId, String version ) | ||||
throws UnresolvableModelException | throws UnresolvableModelException | ||||
{ | { | ||||
String filename = artifactId + "-" + version + ".pom"; | String filename = artifactId + "-" + version + ".pom"; | ||||
// TODO: we need to convert 1.0-20091120.112233-1 type paths to baseVersion for the below call - add a test | // TODO: we need to convert 1.0-20091120.112233-1 type paths to baseVersion for the below call - add a test | ||||
return new FileModelSource( pathTranslator.toFile( basedir, groupId, artifactId, version, filename ) ); | |||||
File model = pathTranslator.toFile( basedir, groupId, artifactId, version, filename ); | |||||
if( !model.exists() ) | |||||
{ | |||||
for( RemoteRepositoryConfiguration remoteRepository : remoteRepositories ) | |||||
{ | |||||
try | |||||
{ | |||||
boolean success = getModelFromProxy( remoteRepository, groupId, artifactId, version, filename ); | |||||
if( success && model.exists() ) | |||||
{ | |||||
log.info( "Model '" + model.getAbsolutePath() + "' successfully retrieved from remote repository '" | |||||
+ remoteRepository.getId() + "'" ); | |||||
break; | |||||
} | |||||
} | |||||
catch( Exception e ) | |||||
{ | |||||
log.warn( "An exception was caught while attempting to retrieve model '" + model.getAbsolutePath() | |||||
+ "' from remote repository '" + remoteRepository.getId() + "'.", e ); | |||||
continue; | |||||
} | |||||
} | |||||
} | |||||
return new FileModelSource( model ); | |||||
} | } | ||||
public void addRepository( Repository repository ) | public void addRepository( Repository repository ) | ||||
{ | { | ||||
return new RepositoryModelResolver( basedir, pathTranslator ); | return new RepositoryModelResolver( basedir, pathTranslator ); | ||||
} | } | ||||
} | |||||
// TODO: we need to do some refactoring, we cannot re-use the proxy components of archiva-proxy in maven2-repository | |||||
// because it's causing a cyclic dependency | |||||
private boolean getModelFromProxy( RemoteRepositoryConfiguration remoteRepository, String groupId, | |||||
String artifactId, String version, String filename ) | |||||
throws AuthorizationException, TransferFailedException, ResourceDoesNotExistException, WagonFactoryException | |||||
{ | |||||
boolean success = false; | |||||
File tmpMd5 = null; | |||||
File tmpSha1 = null; | |||||
File tmpResource = null; | |||||
String artifactPath = pathTranslator.toPath( groupId, artifactId, version, filename ); | |||||
File resource = new File( targetRepository.getLocation(), artifactPath ); | |||||
File workingDirectory = createWorkingDirectory( targetRepository.getLocation() ); | |||||
try | |||||
{ | |||||
Wagon wagon = null; | |||||
try | |||||
{ | |||||
String protocol = getProtocol( remoteRepository.getUrl() ); | |||||
wagon = wagonFactory.getWagon( "wagon#" + protocol ); | |||||
if ( wagon == null ) | |||||
{ | |||||
throw new RuntimeException( "Unsupported remote repository protocol: " + protocol ); | |||||
} | |||||
boolean connected = connectToRepository( wagon, remoteRepository ); | |||||
if ( connected ) | |||||
{ | |||||
tmpResource = new File( workingDirectory, filename ); | |||||
log.info( "Retrieving " + artifactPath + " from " + remoteRepository.getName() ); | |||||
wagon.get( artifactPath, tmpResource ); | |||||
log.debug( "Downloaded successfully." ); | |||||
tmpSha1 = | |||||
transferChecksum( wagon, remoteRepository, artifactPath, tmpResource, workingDirectory, ".sha1" ); | |||||
tmpMd5 = | |||||
transferChecksum( wagon, remoteRepository, artifactPath, tmpResource, workingDirectory, ".md5" ); | |||||
} | |||||
} | |||||
finally | |||||
{ | |||||
if ( wagon != null ) | |||||
{ | |||||
try | |||||
{ | |||||
wagon.disconnect(); | |||||
} | |||||
catch ( ConnectionException e ) | |||||
{ | |||||
log.warn( "Unable to disconnect wagon.", e ); | |||||
} | |||||
} | |||||
} | |||||
if ( resource != null ) | |||||
{ | |||||
synchronized ( resource.getAbsolutePath().intern() ) | |||||
{ | |||||
File directory = resource.getParentFile(); | |||||
moveFileIfExists( tmpMd5, directory ); | |||||
moveFileIfExists( tmpSha1, directory ); | |||||
moveFileIfExists( tmpResource, directory ); | |||||
success = true; | |||||
} | |||||
} | |||||
} | |||||
finally | |||||
{ | |||||
FileUtils.deleteQuietly( workingDirectory ); | |||||
} | |||||
// do we still need to execute the consumers? | |||||
return success; | |||||
} | |||||
/** | |||||
* Using wagon, connect to the remote repository. | |||||
* | |||||
* @param wagon the wagon instance to establish the connection on. | |||||
* @return true if the connection was successful. false if not connected. | |||||
*/ | |||||
private boolean connectToRepository( Wagon wagon, RemoteRepositoryConfiguration remoteRepository ) | |||||
{ | |||||
boolean connected; | |||||
final ProxyInfo networkProxy; | |||||
networkProxy = this.networkProxyMap.get( remoteRepository.getId() ); | |||||
if ( networkProxy != null ) | |||||
{ | |||||
String msg = | |||||
"Using network proxy " + networkProxy.getHost() + ":" + networkProxy.getPort() | |||||
+ " to connect to remote repository " + remoteRepository.getUrl(); | |||||
if ( networkProxy.getNonProxyHosts() != null ) | |||||
{ | |||||
msg += "; excluding hosts: " + networkProxy.getNonProxyHosts(); | |||||
} | |||||
if ( StringUtils.isNotBlank( networkProxy.getUserName() ) ) | |||||
{ | |||||
msg += "; as user: " + networkProxy.getUserName(); | |||||
} | |||||
log.debug( msg ); | |||||
} | |||||
AuthenticationInfo authInfo = null; | |||||
String username = remoteRepository.getUsername(); | |||||
String password = remoteRepository.getPassword(); | |||||
if ( StringUtils.isNotBlank( username ) && StringUtils.isNotBlank( password ) ) | |||||
{ | |||||
log.debug( "Using username " + username + " to connect to remote repository " + remoteRepository.getUrl() ); | |||||
authInfo = new AuthenticationInfo(); | |||||
authInfo.setUserName( username ); | |||||
authInfo.setPassword( password ); | |||||
} | |||||
// Convert seconds to milliseconds | |||||
int timeoutInMilliseconds = remoteRepository.getTimeout() * 1000; | |||||
// Set timeout | |||||
wagon.setTimeout( timeoutInMilliseconds ); | |||||
try | |||||
{ | |||||
org.apache.maven.wagon.repository.Repository wagonRepository = | |||||
new org.apache.maven.wagon.repository.Repository( remoteRepository.getId(), remoteRepository.getUrl() ); | |||||
wagon.connect( wagonRepository, authInfo, networkProxy ); | |||||
connected = true; | |||||
} | |||||
catch ( ConnectionException e ) | |||||
{ | |||||
log.error( "Could not connect to " + remoteRepository.getName() + ": " + e.getMessage() ); | |||||
connected = false; | |||||
} | |||||
catch ( AuthenticationException e ) | |||||
{ | |||||
log.error( "Could not connect to " + remoteRepository.getName() + ": " + e.getMessage() ); | |||||
connected = false; | |||||
} | |||||
return connected; | |||||
} | |||||
private File transferChecksum( Wagon wagon, RemoteRepositoryConfiguration remoteRepository, String remotePath, | |||||
File resource, File tmpDirectory, String ext ) | |||||
throws AuthorizationException, TransferFailedException, ResourceDoesNotExistException | |||||
{ | |||||
File destFile = new File( tmpDirectory, resource.getName() + ext ); | |||||
log.info( "Retrieving " + remotePath + " from " + remoteRepository.getName() ); | |||||
wagon.get( remotePath, destFile ); | |||||
log.debug( "Downloaded successfully." ); | |||||
return destFile; | |||||
} | |||||
private String getProtocol( String url ) | |||||
{ | |||||
String protocol = StringUtils.substringBefore( url, ":" ); | |||||
return protocol; | |||||
} | |||||
private File createWorkingDirectory( String targetRepository ) | |||||
{ | |||||
try | |||||
{ | |||||
File tmpDir = File.createTempFile( ".workingdirectory", null, new File( targetRepository ) ); | |||||
tmpDir.delete(); | |||||
tmpDir.mkdirs(); | |||||
return tmpDir; | |||||
} | |||||
catch ( IOException e ) | |||||
{ | |||||
throw new RuntimeException( "Could not create working directory for this request", e ); | |||||
} | |||||
} | |||||
private void moveFileIfExists( File fileToMove, File directory ) | |||||
{ | |||||
if ( fileToMove != null && fileToMove.exists() ) | |||||
{ | |||||
File newLocation = new File( directory, fileToMove.getName() ); | |||||
if ( newLocation.exists() && !newLocation.delete() ) | |||||
{ | |||||
throw new RuntimeException( "Unable to overwrite existing target file: " + newLocation.getAbsolutePath() ); | |||||
} | |||||
newLocation.getParentFile().mkdirs(); | |||||
if ( !fileToMove.renameTo( newLocation ) ) | |||||
{ | |||||
log.warn( "Unable to rename tmp file to its final name... resorting to copy command." ); | |||||
try | |||||
{ | |||||
FileUtils.copyFile( fileToMove, newLocation ); | |||||
} | |||||
catch ( IOException e ) | |||||
{ | |||||
if ( newLocation.exists() ) | |||||
{ | |||||
log.error( "Tried to copy file " + fileToMove.getName() + " to " + newLocation.getAbsolutePath() | |||||
+ " but file with this name already exists." ); | |||||
} | |||||
else | |||||
{ | |||||
throw new RuntimeException( "Cannot copy tmp file " + fileToMove.getAbsolutePath() | |||||
+ " to its final location", e ); | |||||
} | |||||
} | |||||
finally | |||||
{ | |||||
FileUtils.deleteQuietly( fileToMove ); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} |
import org.apache.archiva.metadata.repository.filter.Filter; | import org.apache.archiva.metadata.repository.filter.Filter; | ||||
import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException; | import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataInvalidException; | ||||
import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; | import org.apache.archiva.metadata.repository.storage.RepositoryStorageMetadataNotFoundException; | ||||
import org.apache.archiva.proxy.common.WagonFactory; | |||||
import org.apache.commons.io.FileUtils; | |||||
import org.apache.maven.archiva.common.utils.FileUtil; | |||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration; | import org.apache.maven.archiva.configuration.ArchivaConfiguration; | ||||
import org.apache.maven.archiva.configuration.Configuration; | import org.apache.maven.archiva.configuration.Configuration; | ||||
import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; | ||||
import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; | |||||
import org.apache.maven.archiva.configuration.RemoteRepositoryConfiguration; | |||||
import org.apache.maven.wagon.Wagon; | |||||
import org.junit.Before; | import org.junit.Before; | ||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.junit.runner.RunWith; | import org.junit.runner.RunWith; | ||||
import org.springframework.test.context.ContextConfiguration; | import org.springframework.test.context.ContextConfiguration; | ||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | ||||
import static org.mockito.Mockito.mock; | |||||
import static org.mockito.Mockito.when; | |||||
import javax.inject.Inject; | import javax.inject.Inject; | ||||
import javax.inject.Named; | import javax.inject.Named; | ||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Arrays; | import java.util.Arrays; | ||||
import java.util.Collection; | import java.util.Collection; | ||||
private static final String TEST_REPO_ID = "test"; | private static final String TEST_REPO_ID = "test"; | ||||
private static final String TEST_REMOTE_REPO_ID = "central"; | |||||
private static final String ASF_SCM_CONN_BASE = "scm:svn:http://svn.apache.org/repos/asf/"; | private static final String ASF_SCM_CONN_BASE = "scm:svn:http://svn.apache.org/repos/asf/"; | ||||
private static final String ASF_SCM_DEV_CONN_BASE = "scm:svn:https://svn.apache.org/repos/asf/"; | private static final String ASF_SCM_DEV_CONN_BASE = "scm:svn:https://svn.apache.org/repos/asf/"; | ||||
private static final String ASF_SCM_VIEWVC_BASE = "http://svn.apache.org/viewvc/"; | private static final String ASF_SCM_VIEWVC_BASE = "http://svn.apache.org/viewvc/"; | ||||
private static final String TEST_SCM_CONN_BASE = "scm:svn:http://svn.example.com/repos/"; | |||||
private static final String TEST_SCM_DEV_CONN_BASE = "scm:svn:https://svn.example.com/repos/"; | |||||
private static final String TEST_SCM_URL_BASE = "http://svn.example.com/repos/"; | |||||
private static final String EMPTY_MD5 = "d41d8cd98f00b204e9800998ecf8427e"; | private static final String EMPTY_MD5 = "d41d8cd98f00b204e9800998ecf8427e"; | ||||
private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709"; | private static final String EMPTY_SHA1 = "da39a3ee5e6b4b0d3255bfef95601890afd80709"; | ||||
@Inject | @Inject | ||||
private ArchivaConfiguration configuration; | private ArchivaConfiguration configuration; | ||||
private WagonFactory wagonFactory; | |||||
@Before | @Before | ||||
public void setUp() | public void setUp() | ||||
throws Exception | throws Exception | ||||
testRepo.setId( TEST_REPO_ID ); | testRepo.setId( TEST_REPO_ID ); | ||||
testRepo.setLocation( new File( "target/test-repository" ).getAbsolutePath() ); | testRepo.setLocation( new File( "target/test-repository" ).getAbsolutePath() ); | ||||
c.addManagedRepository( testRepo ); | c.addManagedRepository( testRepo ); | ||||
RemoteRepositoryConfiguration testRemoteRepo = new RemoteRepositoryConfiguration(); | |||||
testRemoteRepo.setId( TEST_REMOTE_REPO_ID ); | |||||
testRemoteRepo.setLayout( "default" ); | |||||
testRemoteRepo.setName( "Central Repository" ); | |||||
testRemoteRepo.setUrl( "http://central.repo.com/maven2" ); | |||||
testRemoteRepo.setTimeout( 10 ); | |||||
c.addRemoteRepository( testRemoteRepo ); | |||||
ProxyConnectorConfiguration proxyConnector = new ProxyConnectorConfiguration(); | |||||
proxyConnector.setSourceRepoId( TEST_REPO_ID ); | |||||
proxyConnector.setTargetRepoId( TEST_REMOTE_REPO_ID ); | |||||
proxyConnector.setDisabled( false ); | |||||
c.addProxyConnector( proxyConnector ); | |||||
configuration.save( c ); | configuration.save( c ); | ||||
wagonFactory = mock( WagonFactory.class ); | |||||
storage.setWagonFactory( wagonFactory ); | |||||
Wagon wagon = new MockWagon(); | |||||
when( wagonFactory.getWagon( "wagon#http" ) ).thenReturn( wagon ); | |||||
//storage = (Maven2RepositoryStorage) lookup( RepositoryStorage.class, "maven2" ); | //storage = (Maven2RepositoryStorage) lookup( RepositoryStorage.class, "maven2" ); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// Tests for MRM-1411 - START | |||||
@Test | |||||
public void testGetProjectVersionMetadataWithParentSuccessful() | |||||
throws Exception | |||||
{ | |||||
copyTestArtifactWithParent(); | |||||
ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", | |||||
"test-artifact-module-a", "1.0" ); | |||||
MavenProjectFacet facet = (MavenProjectFacet) metadata.getFacet( MavenProjectFacet.FACET_ID ); | |||||
assertEquals( "jar", facet.getPackaging() ); | |||||
assertEquals( "http://maven.apache.org", metadata.getUrl() ); | |||||
assertEquals( "com.example.test", facet.getParent().getGroupId() ); | |||||
assertEquals( "test-artifact-root", facet.getParent().getArtifactId() ); | |||||
assertEquals( "1.0", facet.getParent().getVersion() ); | |||||
assertEquals( "test-artifact-module-a", facet.getArtifactId() ); | |||||
assertEquals( "com.example.test", facet.getGroupId() ); | |||||
assertNull( metadata.getCiManagement() ); | |||||
assertNotNull( metadata.getDescription() ); | |||||
checkApacheLicense( metadata ); | |||||
assertEquals( "1.0", metadata.getId() ); | |||||
assertEquals( "Test Artifact :: Module A", metadata.getName() ); | |||||
String path = "test-artifact/trunk/test-artifact-module-a"; | |||||
assertEquals( TEST_SCM_CONN_BASE + path, metadata.getScm().getConnection() ); | |||||
assertEquals( TEST_SCM_DEV_CONN_BASE + path, metadata.getScm().getDeveloperConnection() ); | |||||
assertEquals( TEST_SCM_URL_BASE + path, metadata.getScm().getUrl() ); | |||||
List<Dependency> dependencies = metadata.getDependencies(); | |||||
assertEquals( 2, dependencies.size() ); | |||||
assertDependency( dependencies.get( 0 ), "commons-io", "commons-io", "1.4" ); | |||||
assertDependency( dependencies.get( 1 ), "junit", "junit", "3.8.1", "test" ); | |||||
deleteTestArtifactWithParent(); | |||||
} | |||||
@Test | |||||
public void testGetProjectVersionMetadataWithParentNoRemoteReposConfigured() | |||||
throws Exception | |||||
{ | |||||
// remove configuration | |||||
Configuration config = configuration.getConfiguration(); | |||||
RemoteRepositoryConfiguration remoteRepo = config.findRemoteRepositoryById( TEST_REMOTE_REPO_ID ); | |||||
config.removeRemoteRepository( remoteRepo ); | |||||
configuration.save( config ); | |||||
copyTestArtifactWithParent(); | |||||
ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", | |||||
"test-artifact-module-a", "1.0" ); | |||||
assertEquals( "1.0", metadata.getId() ); | |||||
MavenProjectFacet facet = ( MavenProjectFacet ) metadata.getFacet( MavenProjectFacet.FACET_ID ); | |||||
assertNotNull( facet ); | |||||
assertEquals( "com.example.test", facet.getGroupId() ); | |||||
assertEquals( "test-artifact-module-a", facet.getArtifactId() ); | |||||
assertEquals( "jar", facet.getPackaging() ); | |||||
deleteTestArtifactWithParent(); | |||||
} | |||||
@Test | |||||
public void testGetProjectVersionMetadataWithParentNotInAnyRemoteRepo() | |||||
throws Exception | |||||
{ | |||||
copyTestArtifactWithParent(); | |||||
ProjectVersionMetadata metadata = storage.readProjectVersionMetadata( TEST_REPO_ID, "com.example.test", "missing-parent", "1.1" ); | |||||
assertEquals( "1.1", metadata.getId() ); | |||||
MavenProjectFacet facet = ( MavenProjectFacet ) metadata.getFacet( MavenProjectFacet.FACET_ID ); | |||||
assertNotNull( facet ); | |||||
assertEquals( "com.example.test", facet.getGroupId() ); | |||||
assertEquals( "missing-parent", facet.getArtifactId() ); | |||||
assertEquals( "jar", facet.getPackaging() ); | |||||
deleteTestArtifactWithParent(); | |||||
} | |||||
// Tests for MRM-1411 - END | |||||
@Test | @Test | ||||
public void testGetRootNamespaces() | public void testGetRootNamespaces() | ||||
{ | { | ||||
assertEquals( Collections.<String>emptyList(), storage.listProjects( TEST_REPO_ID, "com", ALL ) ); | assertEquals( Collections.<String>emptyList(), storage.listProjects( TEST_REPO_ID, "com", ALL ) ); | ||||
assertEquals( Collections.<String>emptyList(), storage.listProjects( TEST_REPO_ID, "com.example", ALL ) ); | assertEquals( Collections.<String>emptyList(), storage.listProjects( TEST_REPO_ID, "com.example", ALL ) ); | ||||
assertEquals( Arrays.asList( "incomplete-metadata", "invalid-pom", "malformed-metadata", "mislocated-pom", | assertEquals( Arrays.asList( "incomplete-metadata", "invalid-pom", "malformed-metadata", "mislocated-pom", | ||||
"missing-metadata", "test-artifact" ), storage.listProjects( TEST_REPO_ID, | |||||
"missing-metadata", "missing-parent", "test-artifact" ), storage.listProjects( TEST_REPO_ID, | |||||
"com.example.test", | "com.example.test", | ||||
ALL ) ); | ALL ) ); | ||||
assertEquals( "The Apache Software Foundation", metadata.getOrganization().getName() ); | assertEquals( "The Apache Software Foundation", metadata.getOrganization().getName() ); | ||||
assertEquals( "http://www.apache.org/", metadata.getOrganization().getUrl() ); | assertEquals( "http://www.apache.org/", metadata.getOrganization().getUrl() ); | ||||
} | } | ||||
private void deleteTestArtifactWithParent() | |||||
throws IOException | |||||
{ | |||||
File dest = new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-module-a" ); | |||||
File parentPom = new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-parent" ); | |||||
File rootPom = new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-root" ); | |||||
FileUtils.deleteDirectory( dest ); | |||||
FileUtils.deleteDirectory( parentPom ); | |||||
FileUtils.deleteDirectory( rootPom ); | |||||
assertFalse( dest.exists() ); | |||||
assertFalse( parentPom.exists() ); | |||||
assertFalse( rootPom.exists() ); | |||||
} | |||||
private File copyTestArtifactWithParent() | |||||
throws IOException | |||||
{ | |||||
File src = new File( FileUtil.getBasedir(), "target/test-classes/com/example/test/test-artifact-module-a" ); | |||||
File dest = new File( FileUtil.getBasedir(), "target/test-repository/com/example/test/test-artifact-module-a" ); | |||||
FileUtils.copyDirectory( src, dest ); | |||||
assertTrue( dest.exists() ); | |||||
return dest; | |||||
} | |||||
} | } |
package org.apache.archiva.metadata.repository.storage.maven2; | |||||
import org.apache.commons.io.FileUtils; | |||||
import org.apache.maven.wagon.ConnectionException; | |||||
import org.apache.maven.wagon.ResourceDoesNotExistException; | |||||
import org.apache.maven.wagon.TransferFailedException; | |||||
import org.apache.maven.wagon.Wagon; | |||||
import org.apache.maven.wagon.authentication.AuthenticationException; | |||||
import org.apache.maven.wagon.authentication.AuthenticationInfo; | |||||
import org.apache.maven.wagon.authorization.AuthorizationException; | |||||
import org.apache.maven.wagon.events.SessionListener; | |||||
import org.apache.maven.wagon.events.TransferListener; | |||||
import org.apache.maven.wagon.proxy.ProxyInfo; | |||||
import org.apache.maven.wagon.proxy.ProxyInfoProvider; | |||||
import org.apache.maven.wagon.repository.Repository; | |||||
import java.io.File; | |||||
import java.io.IOException; | |||||
import java.util.List; | |||||
public class MockWagon | |||||
implements Wagon | |||||
{ | |||||
public void get( String s, File file ) | |||||
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException | |||||
{ | |||||
String sourceFile = getBasedir() + "/target/test-classes/" + s; | |||||
try | |||||
{ | |||||
FileUtils.copyFile( new File( sourceFile ), file ); | |||||
assert( file.exists() ); | |||||
} | |||||
catch( IOException e ) | |||||
{ | |||||
throw new ResourceDoesNotExistException( e.getMessage() ); | |||||
} | |||||
} | |||||
public boolean getIfNewer( String s, File file, long l ) | |||||
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException | |||||
{ | |||||
return false; | |||||
} | |||||
public void put( File file, String s ) | |||||
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException | |||||
{ | |||||
} | |||||
public void putDirectory( File file, String s ) | |||||
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException | |||||
{ | |||||
} | |||||
public boolean resourceExists( String s ) | |||||
throws TransferFailedException, AuthorizationException | |||||
{ | |||||
return false; | |||||
} | |||||
public List getFileList( String s ) | |||||
throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException | |||||
{ | |||||
return null; | |||||
} | |||||
public boolean supportsDirectoryCopy() | |||||
{ | |||||
return false; | |||||
} | |||||
public Repository getRepository() | |||||
{ | |||||
return null; | |||||
} | |||||
public void connect( Repository repository ) | |||||
throws ConnectionException, AuthenticationException | |||||
{ | |||||
} | |||||
public void connect( Repository repository, ProxyInfo proxyInfo ) | |||||
throws ConnectionException, AuthenticationException | |||||
{ | |||||
} | |||||
public void connect( Repository repository, ProxyInfoProvider proxyInfoProvider ) | |||||
throws ConnectionException, AuthenticationException | |||||
{ | |||||
} | |||||
public void connect( Repository repository, AuthenticationInfo authenticationInfo ) | |||||
throws ConnectionException, AuthenticationException | |||||
{ | |||||
} | |||||
public void connect( Repository repository, AuthenticationInfo authenticationInfo, ProxyInfo proxyInfo ) | |||||
throws ConnectionException, AuthenticationException | |||||
{ | |||||
} | |||||
public void connect( Repository repository, AuthenticationInfo authenticationInfo, | |||||
ProxyInfoProvider proxyInfoProvider ) | |||||
throws ConnectionException, AuthenticationException | |||||
{ | |||||
} | |||||
public void openConnection() | |||||
throws ConnectionException, AuthenticationException | |||||
{ | |||||
} | |||||
public void disconnect() | |||||
throws ConnectionException | |||||
{ | |||||
} | |||||
public void setTimeout( int i ) | |||||
{ | |||||
} | |||||
public int getTimeout() | |||||
{ | |||||
return 0; | |||||
} | |||||
public void addSessionListener( SessionListener sessionListener ) | |||||
{ | |||||
} | |||||
public void removeSessionListener( SessionListener sessionListener ) | |||||
{ | |||||
} | |||||
public boolean hasSessionListener( SessionListener sessionListener ) | |||||
{ | |||||
return false; | |||||
} | |||||
public void addTransferListener( TransferListener transferListener ) | |||||
{ | |||||
} | |||||
public void removeTransferListener( TransferListener transferListener ) | |||||
{ | |||||
} | |||||
public boolean hasTransferListener( TransferListener transferListener ) | |||||
{ | |||||
return false; | |||||
} | |||||
public boolean isInteractive() | |||||
{ | |||||
return false; | |||||
} | |||||
public void setInteractive( boolean b ) | |||||
{ | |||||
} | |||||
public String getBasedir() | |||||
{ | |||||
String basedir = System.getProperty( "basedir" ); | |||||
if ( basedir == null ) | |||||
{ | |||||
basedir = new File( "" ).getAbsolutePath(); | |||||
} | |||||
return basedir; | |||||
} | |||||
} |
37786de9e272ed6db8541855e0e2d5dc |
bb1ca7834422926d0cb79ef303b715bc17f41661 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||||
<modelVersion>4.0.0</modelVersion> | |||||
<parent> | |||||
<groupId>com.example.test</groupId> | |||||
<artifactId>test-artifact-root</artifactId> | |||||
<version>1.0</version> | |||||
</parent> | |||||
<artifactId>test-artifact-module-a</artifactId> | |||||
<packaging>jar</packaging> | |||||
<name>Test Artifact :: Module A</name> | |||||
<url>http://maven.apache.org</url> | |||||
<dependencies> | |||||
<dependency> | |||||
<groupId>commons-io</groupId> | |||||
<artifactId>commons-io</artifactId> | |||||
</dependency> | |||||
</dependencies> | |||||
</project> |
61a4d030260fc6bee0681cf99ba54674 |
6f54bc4223bc39d7880420f66baa3a24d7f9c181 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||||
<modelVersion>4.0.0</modelVersion> | |||||
<groupId>com.example.test</groupId> | |||||
<artifactId>test-artifact-parent</artifactId> | |||||
<version>1</version> | |||||
<packaging>pom</packaging> | |||||
<name>Test Artifact :: Parent</name> | |||||
<description>This is the uber parent POM.</description> | |||||
<url>http://test.com</url> | |||||
<scm> | |||||
<connection>scm:svn:http://svn.example.com/repos/test-artifact-parent/trunk</connection> | |||||
<developerConnection>scm:svn:https://svn.example.com/repos/test-artifact-parent/trunk</developerConnection> | |||||
<url>http://svn.example.com/repos/test-artifact-parent/trunk</url> | |||||
</scm> | |||||
<distributionManagement> | |||||
<repository> | |||||
<id>releases</id> | |||||
<name>Releases Repository</name> | |||||
<url>http://repo.test.com/archiva/repository/releases</url> | |||||
</repository> | |||||
<snapshotRepository> | |||||
<id>snapshots</id> | |||||
<name>Snapshots Repository</name> | |||||
<url>http://repo.test.com/archiva/repository/snapshots</url> | |||||
</snapshotRepository> | |||||
</distributionManagement> | |||||
<developers> | |||||
<developer> | |||||
<id>jsmith</id> | |||||
<name>John Smith</name> | |||||
<email>jsmith@mail.com</email> | |||||
</developer> | |||||
</developers> | |||||
<licenses> | |||||
<license> | |||||
<name>The Apache Software License, Version 2.0</name> | |||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | |||||
</license> | |||||
</licenses> | |||||
</project> |
92c60efe85e23fe5afd8a854cea87209 |
6eca3509acf66023c29e2bc17f73e79d1d1a341a |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |||||
<modelVersion>4.0.0</modelVersion> | |||||
<parent> | |||||
<groupId>com.example.test</groupId> | |||||
<artifactId>test-artifact-parent</artifactId> | |||||
<version>1</version> | |||||
</parent> | |||||
<artifactId>test-artifact-root</artifactId> | |||||
<version>1.0</version> | |||||
<packaging>pom</packaging> | |||||
<name>Test Artifact :: Root</name> | |||||
<description>This is the Test project.</description> | |||||
<modules> | |||||
<module>test-artifact-module-a</module> | |||||
<module>test-artifact-module-b</module> | |||||
</modules> | |||||
<scm> | |||||
<connection>scm:svn:http://svn.example.com/repos/test-artifact/trunk</connection> | |||||
<developerConnection>scm:svn:https://svn.example.com/repos/test-artifact/trunk</developerConnection> | |||||
<url>http://svn.example.com/repos/test-artifact/trunk</url> | |||||
</scm> | |||||
<dependencyManagement> | |||||
<dependencies> | |||||
<dependency> | |||||
<groupId>commons-io</groupId> | |||||
<artifactId>commons-io</artifactId> | |||||
<version>1.4</version> | |||||
</dependency> | |||||
</dependencies> | |||||
</dependencyManagement> | |||||
<dependencies> | |||||
<dependency> | |||||
<groupId>junit</groupId> | |||||
<artifactId>junit</artifactId> | |||||
<version>3.8.1</version> | |||||
<scope>test</scope> | |||||
</dependency> | |||||
</dependencies> | |||||
</project> |
034449f8696981edce2485b841a02a47 |
bef26aec1a0714cec7fa56cdbb7ebcdb452295eb |
<dependency> | <dependency> | ||||
<groupId>org.apache.archiva</groupId> | <groupId>org.apache.archiva</groupId> | ||||
<artifactId>archiva-plexus-bridge</artifactId> | <artifactId>archiva-plexus-bridge</artifactId> | ||||
<version>${project.version}</version> | |||||
<version>1.4-SNAPSHOT</version> | |||||
</dependency> | </dependency> | ||||
<dependency> | <dependency> | ||||
<groupId>org.apache.archiva</groupId> | <groupId>org.apache.archiva</groupId> | ||||
<artifactId>archiva-proxy</artifactId> | <artifactId>archiva-proxy</artifactId> | ||||
<version>1.4-SNAPSHOT</version> | <version>1.4-SNAPSHOT</version> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.apache.archiva</groupId> | |||||
<artifactId>archiva-proxy-common</artifactId> | |||||
<version>1.4-SNAPSHOT</version> | |||||
</dependency> | |||||
<dependency> | <dependency> | ||||
<groupId>org.apache.archiva</groupId> | <groupId>org.apache.archiva</groupId> | ||||
<artifactId>archiva-repository-layer</artifactId> | <artifactId>archiva-repository-layer</artifactId> |