Details
-
Type:
Improvement
-
Status:
Reopened
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.1.0
-
Fix Version/s: 2.2.2
-
Component/s: Artifacts and Repositories, POM, Profiles
-
Labels:None
-
Complexity:Intermediate
-
Testcase included:yes
-
Number of attachments :
Description
When we declare a profile in the settings.xml, it will never be applied to POMs loaded from the Maven repository. This means that overriding the central repository definition - for instance - cannot be done without using mirror definitions, since transitive dependencies (any dependency of a direct dependency) will skip the modified definition and use the original from the super-POM instead.
I'm attaching a testing setup that was originally reported for MNG-3553, which exhibits this problem when dealing with scope == import. The instructions for using it are as follows:
I installed locally a nexus server (1.3.3 Open Source) and I'm using maven 2.1.0 (I reproduced the issue with 2.0.10).
In the releases repository of nexus you upload all artifacts given in the toUpload directory :
* parent 1.0.0 pom
* dependencies 1.0.0 pom
* module 1.0.0 pom and jar
You'll find in the root of the archive my settings. It defines to use nexus for the central repository.
You launch a build of the project and you'll have :
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - org.apache.maven.it.mng3553:project:jar:1.0.0-SNAPSHOT
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\jtb\workspaces\tests\test-mng3553\project\src\main\resources
Downloading: http://localhost:8081/nexus/content/groups/public//org/apache/maven/it/mng3553/module/1.0.0/module-1.0.0.pom
867b downloaded (module-1.0.0.pom)
Downloading: http://repo1.maven.org/maven2/org/apache/maven/it/mng3553/dependencies/1.0.0/dependencies-1.0.0.pom
[WARNING] Unable to get resource 'org.apache.maven.it.mng3553:dependencies:pom:1.0.0'
from repository central (http://repo1.maven.org/maven2): Authorization failed: Access denied to:
http://repo1.maven.org/maven2/org/apache/maven/it/mng3553/dependencies/1.0.0/dependencies-1.0.0.pom
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
GroupId: org.apache.maven.it.mng3553
ArtifactId: dependencies
Version: 1.0.0
Reason: Unable to download the artifact from any repository
org.apache.maven.it.mng3553:dependencies:pom:1.0.0
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Apr 30 15:19:47 CEST 2009
[INFO] Final Memory: 6M/254M
[INFO] ------------------------------------------------------------------------
You can see that the project downloads successfully the module-1.0.0 from nexus but
it fails for depencencies which is an import. It tries to download it from the real central repository
and not from the one I defined in my settings.
The behavior is inconsistent...
Issue Links
- is duplicated by
-
MNG-4538
dependencyManagament dependencies within profiles are not activated by settings.xml
-
-
MNG-4930
List of active profiles defined in ~/.m2/settings.xml gets lost when parsing dependency POMs
-
- is related to
-
MNG-3537
"Nested imports" doesn't work on Maven 2.0.9
-
-
MNG-2626
System scope dependencies in parent POM cause validation warnings for most plugins and errors in assembly plugin
-
-
MNG-3553
cannot resolve dependency with scope import
-
-
MNG-4181
system path dependencies are not resolved
-
-
MNG-4347
import-scoped dependencies of direct dependencies are not resolved using profile modifications from settings.xml
-
- relates to
-
MNG-3612
property in settings.xml not interpolated when resolving parent POM from remote repository
-
-
MNG-3782
Variable substition not performed in transitive dependency using value from active profile
-
-
MNG-4809
${settings.localRepository} is not resolved when used in systemPath
-
- supercedes
-
MNG-2626
System scope dependencies in parent POM cause validation warnings for most plugins and errors in assembly plugin
-
Activity
| Fix Version/s | 2.2.x [ 13141 ] |
| Fix Version/s | 2.2.2 [ 15472 ] | |
| Fix Version/s | 2.2.x [ 13141 ] |
| Description |
When we declare a profile in the settings.xml, it will never be applied to POMs loaded from the Maven repository. This means that overriding the central repository definition - for instance - cannot be done without using mirror definitions, since transitive dependencies (any dependency of a direct dependency) will skip the modified definition and use the original from the super-POM instead. I'm attaching a testing setup that was originally reported for {noformat} I installed locally a nexus server (1.3.3 Open Source) and I'm using maven 2.1.0 (I reproduced the issue with 2.0.10). In the releases repository of nexus you upload all artifacts given in the toUpload directory : * parent 1.0.0 pom * dependencies 1.0.0 pom * module 1.0.0 pom and jar You'll find in the root of the archive my settings. It defines to use nexus for the central repository. You launch a build of the project and you'll have : [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Unnamed - org.apache.maven.it.mng3553:project:jar:1.0.0-SNAPSHOT [INFO] task-segment: [install] [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources] [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory E:\jtb\workspaces\tests\test-mng3553\project\src\main\resources Downloading: http://localhost:8081/nexus/content/groups/public//org/apache/maven/it/mng3553/module/1.0.0/module-1.0.0.pom 867b downloaded (module-1.0.0.pom) Downloading: http://repo1.maven.org/maven2/org/apache/maven/it/mng3553/dependencies/1.0.0/dependencies-1.0.0.pom [WARNING] Unable to get resource 'org.apache.maven.it.mng3553:dependencies:pom:1.0.0' from repository central (http://repo1.maven.org/maven2): Authorization fai led: Access denied to: http://repo1.maven.org/maven2/org/apache/maven/it/mng3553/dependencies/1.0.0/dependencies-1.0.0.pom [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. GroupId: org.apache.maven.it.mng3553 ArtifactId: dependencies Version: 1.0.0 Reason: Unable to download the artifact from any repository org.apache.maven.it.mng3553:dependencies:pom:1.0.0 from the specified remote repositories: central (http://repo1.maven.org/maven2) [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 second [INFO] Finished at: Thu Apr 30 15:19:47 CEST 2009 [INFO] Final Memory: 6M/254M [INFO] ------------------------------------------------------------------------ You can see that the project downloads successfully the module-1.0.0 from nexus but it fails for depencencies which is an import. It tries to download it from the real central repository and not from the one I defined in my settings. The behavior is inconsistent... {noformat} |
When we declare a profile in the settings.xml, it will never be applied to POMs loaded from the Maven repository. This means that overriding the central repository definition - for instance - cannot be done without using mirror definitions, since transitive dependencies (any dependency of a direct dependency) will skip the modified definition and use the original from the super-POM instead. I'm attaching a testing setup that was originally reported for {noformat} I installed locally a nexus server (1.3.3 Open Source) and I'm using maven 2.1.0 (I reproduced the issue with 2.0.10). In the releases repository of nexus you upload all artifacts given in the toUpload directory : * parent 1.0.0 pom * dependencies 1.0.0 pom * module 1.0.0 pom and jar You'll find in the root of the archive my settings. It defines to use nexus for the central repository. You launch a build of the project and you'll have : [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Unnamed - org.apache.maven.it.mng3553:project:jar:1.0.0-SNAPSHOT [INFO] task-segment: [install] [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources] [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory E:\jtb\workspaces\tests\test-mng3553\project\src\main\resources Downloading: http://localhost:8081/nexus/content/groups/public//org/apache/maven/it/mng3553/module/1.0.0/module-1.0.0.pom 867b downloaded (module-1.0.0.pom) Downloading: http://repo1.maven.org/maven2/org/apache/maven/it/mng3553/dependencies/1.0.0/dependencies-1.0.0.pom [WARNING] Unable to get resource 'org.apache.maven.it.mng3553:dependencies:pom:1.0.0' from repository central (http://repo1.maven.org/maven2): Authorization failed: Access denied to: http://repo1.maven.org/maven2/org/apache/maven/it/mng3553/dependencies/1.0.0/dependencies-1.0.0.pom [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. GroupId: org.apache.maven.it.mng3553 ArtifactId: dependencies Version: 1.0.0 Reason: Unable to download the artifact from any repository org.apache.maven.it.mng3553:dependencies:pom:1.0.0 from the specified remote repositories: central (http://repo1.maven.org/maven2) [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 second [INFO] Finished at: Thu Apr 30 15:19:47 CEST 2009 [INFO] Final Memory: 6M/254M [INFO] ------------------------------------------------------------------------ You can see that the project downloads successfully the module-1.0.0 from nexus but it fails for depencencies which is an import. It tries to download it from the real central repository and not from the one I defined in my settings. The behavior is inconsistent... {noformat} |
| Assignee | John Casey [ jdcasey ] | |
| Resolution | Fixed [ 1 ] | |
| Status | Open [ 1 ] | Closed [ 6 ] |
| Resolution | Fixed [ 1 ] | |
| Status | Closed [ 6 ] | Reopened [ 4 ] |
The relationship between these issues merely captures the fact that
MNG-3553was where this issue was originally uncovered.