On Tue, 21 Feb 2017 16:16:55 +0100, Petar Tahchiev <[email protected]> wrote:

Hello guys,

I've recently found out something weird while working with the asciidoctor
maven plugin.My project has the following structure:

PARENT:
 - MODULEA
 - MODULEB
 - MODULEC

and the asciidoctor team have created this doxia parser to be able to
render asciidoc content as part of your maven site:

https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/master/src/main/java/org/asciidoctor/maven/site/AsciidoctorParser.java#L53

Note that they are injecting the MavenProject like this:

    @Requirement
    protected MavenProject project;

and when I run the site generation at the PARENT (mvn clean site) this
parser gets called 4 times, and all the 4 times the MavenProject that gets
injected is PARENT.

However, if I run the site generation at PARENT but tell it to resume from
MODULEA:

mvn clean site -rf :MODULEA

then the MavenProject is MODULEA every time. First time it is MODULEA,
second time it is MODULEA and third time it is MODULEA.

This may seem like a very small difference, but if you use properties like ${project.build.directory} then suddenly your site and images are generated
in wrong folders.

My questions is:
  1) Does it look like a bug in Maven reactor? Or perhaps plexus?

MavenProject is not something which should work like this. It would mean that project is a @Named component (JSR330), which it isn't. So I think that it leaks to the plexus context, which shouldn't happen, but might explain why you always get the same instance.
A MavenProject is something which needs to be passed as an argument.

Robert

2) Is there any special way that I can inject the current child module of
the mulit-module build. I want the MavenProject that is injected to be
first time MODULEA, second time MODULEB and third time MODULEC.

Regarding point 2 I saw Anders had the same question here:

http://maven.40175.n5.nabble.com/Get-hold-of-MavenProject-object-of-a-module-in-a-multi-module-build-td5811486.html

but I didn't get the answer.

Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to