maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thibaud Lepretre (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (MNG-6716) relative testSourceDirectory on macos throw duplicate class error
Date Tue, 30 Jul 2019 10:29:00 GMT

    [ https://issues.apache.org/jira/browse/MNG-6716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16895989#comment-16895989
] 

Thibaud Lepretre edited comment on MNG-6716 at 7/30/19 10:28 AM:
-----------------------------------------------------------------

Using fabulous {{git bisect}} I can claim that regression comes from

[https://github.com/apache/maven/commit/8b7055fe3ff3696b821409a6904ff4d69aa3ff6b]
{code:java}
8b7055fe3ff3696b821409a6904ff4d69aa3ff6b is the first bad commit
commit 8b7055fe3ff3696b821409a6904ff4d69aa3ff6b
Author: Mickael Istria <mistria@redhat.com>
Date:   Thu Nov 29 22:21:29 2018 +0100

    [MNG-6533] Prefer passing the interim project in ProjectBuildingResult

    Initialize the interim project with "simple" items (ie do not build
    not reference parent if it's not yet in the projectIndex) and returns
    it when installation fails further.
    This give a partial validation of the file, pretty convenient in IDEs.

 .../maven/project/DefaultProjectBuilder.java       | 46 ++++++++++++++++------
 1 file changed, 33 insertions(+), 13 deletions(-)
{code}
/cc [~mickael.istria]

—

Since {{8b7055fe3ff3696b821409a6904ff4d69aa3ff6b}} there is now 2 {{initProject}} steps

On first step there is only 1 {{testSourcePath}}

!image-2019-07-30-12-27-38-526.png!!image-2019-07-30-12-26-50-201.png!

but when initProject on 2nd step that add second path

 


was (Author: kakawait):
Using fabulous {{git bisect}} I can claim that regression comes from

https://github.com/apache/maven/commit/8b7055fe3ff3696b821409a6904ff4d69aa3ff6b

{code}
8b7055fe3ff3696b821409a6904ff4d69aa3ff6b is the first bad commit
commit 8b7055fe3ff3696b821409a6904ff4d69aa3ff6b
Author: Mickael Istria <mistria@redhat.com>
Date:   Thu Nov 29 22:21:29 2018 +0100

    [MNG-6533] Prefer passing the interim project in ProjectBuildingResult

    Initialize the interim project with "simple" items (ie do not build
    not reference parent if it's not yet in the projectIndex) and returns
    it when installation fails further.
    This give a partial validation of the file, pretty convenient in IDEs.

 .../maven/project/DefaultProjectBuilder.java       | 46 ++++++++++++++++------
 1 file changed, 33 insertions(+), 13 deletions(-)
{code}

/cc [~mickael.istria]

> relative testSourceDirectory on macos throw duplicate class error
> -----------------------------------------------------------------
>
>                 Key: MNG-6716
>                 URL: https://issues.apache.org/jira/browse/MNG-6716
>             Project: Maven
>          Issue Type: Bug
>          Components: core, POM
>    Affects Versions: 3.6.1
>         Environment: MacOS Sierra 10.12.6
> mvn 3.6.1
>            Reporter: Thibaud Lepretre
>            Priority: Minor
>             Fix For: waiting-for-feedback
>
>         Attachments: Screen Shot 2019-07-30 at 12.24.19.png, Screen Shot 2019-07-30 at
12.24.53.png, Screen Shot 2019-07-30 at 12.24.53.png, image-2019-07-30-12-26-50-201.png, image-2019-07-30-12-27-38-526.png
>
>
> With custom folder structure where test source folder is not sharing the same parent
folder as source folder, for example (is just a sample structure itself is not the key point):
> {code:java}
> ws/bug-macos-tstsrc-relative-path-src/src/main/java
> ws/bug-macos-tstsrc-relative-path-tst/src
> {code}
> With following pom.xml customization
> {code:java}
> <testSourceDirectory>../bug-macos-tstsrc-relative-path-tst/src</testSourceDirectory>
{code}
> On {{<= 3.6.0}} *everything works* but until 3.6.1 MacOS (I'm not able to reproduce
on Docker container maven:3.6.1), I have the following error:
> {code:java}
> AppTest.java:[10,8] duplicate class: dev.thibaud.AppTest{code}
> And if I check with {{-X}} I saw 2 paths added instead of 1
> {code:java}
> [DEBUG] Source roots:
>  [DEBUG]  /private/tmp/mvntest/ws/bug-macos-tstsrc-relative-path-src/../bug-macos-tstsrc-relative-path-tst/src
>  [DEBUG]  /private/tmp/mvntest/ws/bug-macos-tstsrc-relative-path-tst/src{code}
> h2. *How to reproduce:*
> {code:java}
> #!/usr/bin/env bash
> readonly SRC_FOLDER="bug-macos-tstsrc-relative-path-src"
> readonly TST_FOLDER="bug-macos-tstsrc-relative-path-tst"
> mkdir -p ws
> cd ws/
> mvn archetype:generate -DgroupId=dev.thibaud -DartifactId=${SRC_FOLDER} -DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false
> mkdir -p ${TST_FOLDER}/src/
> mv ${SRC_FOLDER}/src/test/java/* ${TST_FOLDER}/src/
> rm -fr ${SRC_FOLDER}/src/test
> cat <<EOT > ${SRC_FOLDER}/pom.xml
> <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>dev.thibaud</groupId>
>   <artifactId>bug-macos-tstsrcrelative-path</artifactId>
>   <packaging>jar</packaging>
>   <version>1.0-SNAPSHOT</version>
>   <name>bug-macos-tstsrcrelative-path</name>
>   <url>http://maven.apache.org</url>
>   <dependencies>
>     <dependency>
>       <groupId>junit</groupId>
>       <artifactId>junit</artifactId>
>       <version>3.8.1</version>
>       <scope>test</scope>
>     </dependency>
>   </dependencies>
>   <build>
>       <testSourceDirectory>../${TST_FOLDER}/src</testSourceDirectory>
>   </build>
> </project>
> EOT{code}
> Then simply run
> {code:java}
> mvn -f bug-macos-tstsrc-relative-path-src/pom.xml clean test -X{code}
> h2. *Workaround:*
> is not using relative path by editing
> {code:java}
> <testSourceDirectory>../bug-macos-tstsrc-relative-path-tst/src</testSourceDirectory>{code}
> to
> {code:java}
> <testSourceDirectory>${project.basedir}/../bug-macos-tstsrc-relative-path-tst/src</testSourceDirectory>{code}
>  
>  PS: maybe affect {{sourceDirectory}} but no tested



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Mime
View raw message