[
http://jira.codehaus.org/browse/MNG-4494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Igor Fedorenko closed MNG-4494.
-------------------------------
Resolution: Fixed
Fix Version/s: 3.0-alpha-6
Implemented in r891083.
> Custom repository layout should be able to participate in repository instance
> creation
> --------------------------------------------------------------------------------------
>
> Key: MNG-4494
> URL: http://jira.codehaus.org/browse/MNG-4494
> Project: Maven 2 & 3
> Issue Type: Improvement
> Affects Versions: 3.0-alpha-5
> Reporter: Igor Fedorenko
> Fix For: 3.0-alpha-6
>
>
> Custom repository layout, like p2, for example, may require special
> ArtifactRepository implementation and/or configuration to work along with
> regular maven repositories. To support this, custom repository layout
> implementations should be able to act as ArtifactRepository instance
> factories. Below is proposed trivial fix, but I'll try to commit this myself,
> assuming I can figure out what's wrong with my svn access.
> {noformat}
> Index:
> maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java
> ===================================================================
> ---
> maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java
> (revision 890982)
> +++
> maven-compat/src/main/java/org/apache/maven/repository/legacy/repository/DefaultArtifactRepositoryFactory.java
> (working copy)
> -26,6 +26,7 @@
> import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
> import org.apache.maven.artifact.repository.MavenArtifactRepository;
> import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
> +import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout2;
> import org.codehaus.plexus.component.annotations.Component;
> import org.codehaus.plexus.component.annotations.Requirement;
>
> -124,7 +125,17 @@
> releases.setChecksumPolicy( globalChecksumPolicy );
> }
>
> - ArtifactRepository repository = new MavenArtifactRepository( id,
> url, repositoryLayout, snapshots, releases );
> + ArtifactRepository repository;
> + if ( repositoryLayout instanceof ArtifactRepositoryLayout2 )
> + {
> + repository =
> + ( (ArtifactRepositoryLayout2) repositoryLayout
> ).newMavenArtifactRepository( id, url, snapshots,
> +
> releases );
> + }
> + else
> + {
> + repository = new MavenArtifactRepository( id, url,
> repositoryLayout, snapshots, releases );
> + }
>
> return repository;
> }
> Index:
> maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/ArtifactRepositoryLayout.java
> ===================================================================
> ---
> maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/ArtifactRepositoryLayout.java
> (revision 890982)
> +++
> maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/ArtifactRepositoryLayout.java
> (working copy)
> -22,6 +22,7 @@
> import org.apache.maven.artifact.Artifact;
> import org.apache.maven.artifact.metadata.ArtifactMetadata;
> import org.apache.maven.artifact.repository.ArtifactRepository;
> +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
>
> /** @author jdcasey */
> public interface ArtifactRepositoryLayout
> Index:
> maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/ArtifactRepositoryLayout2.java
> ===================================================================
> ---
> maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/ArtifactRepositoryLayout2.java
> (revision 0)
> +++
> maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/ArtifactRepositoryLayout2.java
> (revision 0)
> -0,0 +1,31 @@
> +package org.apache.maven.artifact.repository.layout;
> +
> +import org.apache.maven.artifact.repository.ArtifactRepository;
> +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
> +
> +/*
> + * 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.
> + */
> +
> +public interface ArtifactRepositoryLayout2
> + extends ArtifactRepositoryLayout
> +{
> +
> + ArtifactRepository newMavenArtifactRepository( String id, String url,
> ArtifactRepositoryPolicy snapshots,
> + ArtifactRepositoryPolicy
> releases );
> +}
> {noformat}
> Original problem and corresponding build failure:
> https://issues.sonatype.org/browse/TYCHO-324
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira