Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with building with maven 3.8.2 #1242

Closed
pzygielo opened this issue Aug 16, 2021 · 9 comments · Fixed by #1244 or #1272
Closed

Problem with building with maven 3.8.2 #1242

pzygielo opened this issue Aug 16, 2021 · 9 comments · Fixed by #1244 or #1272

Comments

@pzygielo
Copy link

Since maven 3.8.2 (which includes apache/maven@5a89973 that I think is the cause of change) the EL can no longer be built due to directory-maven-plugin not being compatible (and BTW probably dead anyway).

It results with:

[ERROR] Failed to execute goal org.commonjava.maven.plugins:directory-maven-plugin:0.3.1:highest-basedir (find-project-root) on project org.eclipse.persistence.parent: Cannot find a single highest directory for this project set. First two candidates directories don't share a common root. -> [Help 1]

As maven versions are not specified exactly in

- run: mvn -B clean package -DskipTests
or in
maven 'apache-maven-latest'
they might be upgraded out of control of this project.

Please consider taking action before that happens.

pzygielo referenced this issue in apache/maven Aug 16, 2021
…uilder.build(ModelSource, ...)

Actually a subset backport of MNG-5669 (5cdb833)

Also-By: rfscholte <[email protected]>

This closes #478
@michael-o
Copy link

Do you consider this to be a regression or just surfaced a bug in the mentioned plugin?

@pzygielo
Copy link
Author

Do you consider this to be a regression or just surfaced a bug in the mentioned plugin?

As MNG-7170 is classified as improvement, I'd think that this is regression in maven, unexpected in microrelease (3.8.1 to 3.8.2).

maven-3.8.2 declares

Fixes and non-invasive backports from Maven 4.0.0-alpha-1.

I have not investigated the plugin itself, so have no idea what happens there to result with:

Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot find a single highest directory for this project set. First two candidates directories don't share a common root.
    at org.commonjava.maven.plugins.execroot.HighestBasedirGoal.findDirectory (HighestBasedirGoal.java:121)
    at org.commonjava.maven.plugins.execroot.AbstractDirectoryGoal.execute (AbstractDirectoryGoal.java:80)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)

But this works with 3.8.1 and it doesn't break the build.

Nothing related seems to be mentioned in known-issues yet.

@michael-o
Copy link

michael-o commented Aug 16, 2021

It could be a regression, but also just a bug in the plugin. @jdcasey, can you help out on your plugin? @mickaelistria any idea?

@pzygielo Then this plugin will be broken on Maven 4 as well. Reverting just fix the symptom, not the root cause. It would be very helpful if you could isolate this with a sample project and create an issue with Maven.

@pzygielo
Copy link
Author

I have not investigated the plugin itself, so have no idea what happens there

With 3.8.1 files has only one element - current project.
With 3.8.2 files contains additionally parent.

I think the plugin has problem with recognizing parent now, as parent has not-null basedir.

stop at org.commonjava.maven.plugins.execroot.HighestBasedirGoal:80
monitor print p
monitor print p.getBasedir()

@michael-o
Copy link

So you are saying it retrieves the wrong value?

@mickaelistria
Copy link

I think p.getBasedir() == null is erroneously used in order to check whether p is a resolved parent. I am not aware of anything in Maven that implies such assumption; so it seems to me the building is built on a non-specified side-effect, that changed in the meantime.

@michael-o
Copy link

I think p.getBasedir() == null is erroneously used in order to check whether p is a resolved parent. I am not aware of anything in Maven that implies such assumption; so it seems to me the building is built on a non-specified side-effect, that changed in the meantime.

Thanks for the info! @pzygielo Can you locally drop this assumption and see whether the plugin works?

@rfelcman
Copy link
Contributor

I tried to replace org.commonjava.maven.plugins:directory-maven-plugin:0.3.1 with following (additional debug comments there) but same issue with Maven 3.8.2:

          <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>groovy-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>find-project-root</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>
                                <![CDATA[
                                def rootPom = project;
                                log.info("Current project parent [rootPom.parent]:  " + rootPom.parent);
                                log.info("Current project parent basedir [rootPom.parent.basedir]:  " + rootPom.parent.basedir);
                                while (rootPom.parent.basedir != null) {
                                    log.info("Current project [rootPom]:  " + rootPom);
                                    log.info("Current project basedir [rootPom.basedir]:  " + rootPom.basedir);
                                    log.info("parent project [rootPom.parent]:  " + rootPom.parent);
                                    log.info("parent project basedir [rootPom.parent.basedir]:  " + rootPom.parent.basedir);
                                    rootPom = rootPom.parent;
                                }
                                project.properties.setProperty("project.root.location", rootPom.basedir.toString());
                                log.info("EclipseLink Parent project directory [project.root.location]:  " + project.properties['project.root.location']);
                                log.info("Topmost parent directory [rootPom.basedir]:  " + rootPom.basedir);
                                ]]>
                            </source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

@michael-o
Copy link

@pzygielo pzygielo changed the title Problem with building with maven 3.8.2 waiting to hit on CI Problem with building with maven 3.8.2 Aug 17, 2021
@lukasj lukasj linked a pull request Sep 3, 2021 that will close this issue
rfelcman added a commit to rfelcman/eclipselink that referenced this issue Sep 6, 2021
rfelcman added a commit that referenced this issue Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants