[ 
https://issues.apache.org/jira/browse/MNG-7527?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrey Panfilov updated MNG-7527:
---------------------------------
    Description: 
After resolving MNG-4660  ReactorReader 
([https://github.com/apache/maven/blob/master/maven-core/src/main/java/org/apache/maven/ReactorReader.java#L220])
 tries to pick up packaged main artifact without taking into account what 
classifier was actually requested:

 
{code:java}
private File determinePreviouslyPackagedArtifactFile( MavenProject project, 
Artifact artifact )
{
    if ( artifact == null )
   
{         return null;     }
    String fileName = String.format( "%s.%s", 
project.getBuild().getFinalName(), artifact.getExtension() );
    return new File( project.getBuild().getDirectory(), fileName );
} {code}
 

That new behaviour causes following issues:
 * if extension of main artifact differs from classifier's (e.g. war/classes) 
ReactorReader fails to pick up artifact (gh link to demo project: 
[https://github.com/andreybpanfilov/MNG-7527])
 * if extension of main artifact does not differ from classifier's 
ReactorReader picks up wrong artifact 

 

I have discovered another issue - the `mvn package clean package` command might 
look insane, however, I do believe it reveals there are some issues with 
internal state of artifacts/dependencies:

 
{code:java}
MNG-7527 % ~/app/maven/4.0/bin/mvn package clean package -f mng7527-dep2
[INFO] Building jar: 
/Users/apanfilov/work/svn/gh/MNG-7527/mng7527-dep2/target/mng7527-dep2-0.0.1-SNAPSHOT.jar
[INFO] 
--------------------------------------------------------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] 
--------------------------------------------------------------------------------------------------------------------------
[INFO] Total time:  1.063 s
[INFO] Finished at: 2022-08-08T21:05:18+10:00
[INFO] 
--------------------------------------------------------------------------------------------------------------------------
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-jar-plugin:3.2.0:jar (default-jar) on project 
mng7527-dep2: You have to use a classifier to attach supplemental artifacts to 
the project instead of replacing them. -> [Help 1]
[ERROR] {code}
 

 

  was:
After resolving MNG-4660  ReactorReader 
([https://github.com/apache/maven/blob/master/maven-core/src/main/java/org/apache/maven/ReactorReader.java#L220])
 tries to pick up packaged main artifact without taking into account what 
classifier was actually requested:

 
{code:java}
private File determinePreviouslyPackagedArtifactFile( MavenProject project, 
Artifact artifact )
{
    if ( artifact == null )
   
{         return null;     }
    String fileName = String.format( "%s.%s", 
project.getBuild().getFinalName(), artifact.getExtension() );
    return new File( project.getBuild().getDirectory(), fileName );
} {code}
 

That new behaviour causes following issues:
 * if extension of main artifact differs from classifier's (e.g. war/classes) 
ReactorReader fails to pick up artifact (gh link to demo project: 
https://github.com/andreybpanfilov/MNG-7527)
 * if extension of main artifact does not differ from classifier's 
ReactorReader picks up wrong artifact 

 

 


> Resolving inter-module dependencies does not work like expected
> ---------------------------------------------------------------
>
>                 Key: MNG-7527
>                 URL: https://issues.apache.org/jira/browse/MNG-7527
>             Project: Maven
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 4.0.0-alpha-1
>            Reporter: Andrey Panfilov
>            Assignee: Maarten Mulders
>            Priority: Major
>         Attachments: MNG-7527.zip
>
>
> After resolving MNG-4660  ReactorReader 
> ([https://github.com/apache/maven/blob/master/maven-core/src/main/java/org/apache/maven/ReactorReader.java#L220])
>  tries to pick up packaged main artifact without taking into account what 
> classifier was actually requested:
>  
> {code:java}
> private File determinePreviouslyPackagedArtifactFile( MavenProject project, 
> Artifact artifact )
> {
>     if ( artifact == null )
>    
> {         return null;     }
>     String fileName = String.format( "%s.%s", 
> project.getBuild().getFinalName(), artifact.getExtension() );
>     return new File( project.getBuild().getDirectory(), fileName );
> } {code}
>  
> That new behaviour causes following issues:
>  * if extension of main artifact differs from classifier's (e.g. war/classes) 
> ReactorReader fails to pick up artifact (gh link to demo project: 
> [https://github.com/andreybpanfilov/MNG-7527])
>  * if extension of main artifact does not differ from classifier's 
> ReactorReader picks up wrong artifact 
>  
> I have discovered another issue - the `mvn package clean package` command 
> might look insane, however, I do believe it reveals there are some issues 
> with internal state of artifacts/dependencies:
>  
> {code:java}
> MNG-7527 % ~/app/maven/4.0/bin/mvn package clean package -f mng7527-dep2
> [INFO] Building jar: 
> /Users/apanfilov/work/svn/gh/MNG-7527/mng7527-dep2/target/mng7527-dep2-0.0.1-SNAPSHOT.jar
> [INFO] 
> --------------------------------------------------------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] 
> --------------------------------------------------------------------------------------------------------------------------
> [INFO] Total time:  1.063 s
> [INFO] Finished at: 2022-08-08T21:05:18+10:00
> [INFO] 
> --------------------------------------------------------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-jar-plugin:3.2.0:jar (default-jar) on project 
> mng7527-dep2: You have to use a classifier to attach supplemental artifacts 
> to the project instead of replacing them. -> [Help 1]
> [ERROR] {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to