You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Martin Kanters (Jira)" <ji...@apache.org> on 2020/09/22 20:02:00 UTC

[jira] [Commented] (MNG-6990) Build order not set corectly

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

Martin Kanters commented on MNG-6990:
-------------------------------------

Hi Stefano,

I took a look at your testproject with the parent, and there is one thing that you can do to resolve your problem. 

The parent project has no links to the modules, which if you want to build all modules in one maven invocation is needed (in the latest release of Maven: 3.6.3).
1. So, in the parent POM, you should add the following:
{{<modules>}}
{{  <module>../css-test-one</module>}}
{{  <module>../css-test-two</module>}}
{{ </modules>}}

2. In your child poms you should add to your <parent> section:
{{<relativePath>../css-test-parent</relativePath> }}

I've added the testproject with the changes as {{[^test-with-parent-fixed.zip]}}. running mvn compile in the parent directory works fine for me:

{{[INFO] Reactor Summary for css-test-parent 0.0.1-SNAPSHOT:}}
{{[INFO]}}
{{[INFO] css-test-parent .................................... SUCCESS [ 0.030 s]}}
{{[INFO] css-test-two ....................................... SUCCESS [ 4.542 s]}}
{{[INFO] css-test-one ....................................... SUCCESS [ 0.100 s]}}

By the way, a more convential project setup would be to put the parent pom in a parent directory of the modules. Then the "../" in point 1 are not needed, and 2. is not needed at all. 
I have not tested this in Eclipse, but it's possible that it will be able to run the modules in the correct order with this configuration. I'll leave that for you to try. 
Please let us know if this has solved your problem or not, otherwise we'll deem the issue as resolved.

 

> Build order not set corectly
> ----------------------------
>
>                 Key: MNG-6990
>                 URL: https://issues.apache.org/jira/browse/MNG-6990
>             Project: Maven
>          Issue Type: Bug
>          Components: Bootstrap &amp; Build
>    Affects Versions: 3.3.9, 3.5.3, 3.6.3
>         Environment: OS:
> Kubuntu 18.04 LTS
> JDK:
> openjdk version "1.8.0_265"
> OpenJDK Runtime Environment (build 1.8.0_265-8u265-b01-0ubuntu2~18.04-b01)
> OpenJDK 64-Bit Server VM (build 25.265-b01, mixed mode)
> Projects have been tested with Eclipse Photon, 2020-06, 2020-09
>            Reporter: Stefano Cazzola
>            Priority: Major
>         Attachments: test-no-parent.zip, test-with-parent-fixed.zip, test-with-parent.zip
>
>
> It seems that Maven is not able to decide the correct build order when two projects extend the same parent but one has a dependency on the other.
> More precisely, it seems that whenever projects extend the same parent, they are built following the alphabetical order: this means that if project A depends on project B, it is nonetheless built before B, generating compilation error.
> I've created some very simple example I'm attaching to this ticket, one using a parent  (which does not compile), one not (which does compile).
> Please note that I tested specifically against the versions I mentioned. I would not be able to say if in previous versions the build order was detected corretcly, or if it was resolved in some intermediate version.
> Please note also that I am not able to tell if it's a Maven or Eclipse issue. For this reason I'm filing the same ticket to the Eclipse Team.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)