[jira] [Comment Edited] (MSITE-849) Unable to inject MavenProject when using `mvn site:run`

2019-08-18 Thread Abel Salgado Romero (JIRA)


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

Abel Salgado Romero edited comment on MSITE-849 at 8/18/19 6:13 PM:


{quote}I don't think that Doxia should be tied to MavenProject. It can be used 
and shall be used w/o Maven.{quote}
There's no other way to add additional configurations to custom converters, so 
we just rolled with it.
If it should be in another way, that's definitely a question to the Doxia 
Leads. Imho it's a bit too restrictive with what information it makes available 
to converters.

{quote}If you say that the Asciidoc parser ist not init'ed. Are you sure that 
this component is handled properly at all?{quote}
The no initialization is because (I assume) uses some lazy init. And since it 
works fine with {{site:site}}, I assume it's correct.


was (Author: abel s.romero):
{quote}I don't think that Doxia should be tied to MavenProject. It can be used 
and shall be used w/o Maven.{quote}
There's no other way to add additional configurations to custom converters, so 
we just rolled with it.
If it should be in another way, that's definitely a question to the Doxia 
Leads. Imho it's a bit too restrictive with what information it makes available 
to converters.

{quote}If you say that the Asciidoc parser ist not init'ed. Are you sure that 
this component is handled properly at all?{quote}
The no initialization is because -I assume- uses some lazy init. And since it 
works fine with {{site:site}}, I assume it's correct.

> Unable to inject MavenProject when using `mvn site:run`
> ---
>
> Key: MSITE-849
> URL: https://issues.apache.org/jira/browse/MSITE-849
> Project: Maven Site Plugin
>  Issue Type: New Feature
>Affects Versions: 3.7.1, 3.8.2
>Reporter: Abel Salgado Romero
>Assignee: Michael Osipov
>Priority: Major
>
> In https://github.com/asciidoctor/asciidoctor-maven-plugin we inject a 
> MavenProject to obtain addition configurations from the pom.xml 
> (https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/a4d86a949643ab68c124fd4c1b9b936412637d93/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java#L54).
> This works fine with {{site:site}}, but when using {{site:run}} and accessing 
> one of the Asciidoc generated pages we get the error below.
> I saw that:
> * The error occurs when trying to retrieve the instance of the MavenProject.
> * Behavior is the same if I directly inject the MavenProject instead of using 
> a provider. That is, {{site:site}} works, {{site:run}} fails because it 
> cannot find the instance.
> {code:java}
> HTTP ERROR 500
> Problem accessing /hello.html. Reason:
> Server Error
> Caused by:
> com.google.inject.ProvisionException: Unable to provision, see the following 
> errors:
> 1) Error in custom provider, com.google.inject.OutOfScopeException: Cannot 
> access Key[type=org.apache.maven.project.MavenProject, annotation=[none]] 
> outside of a scoping block
>   at 
> org.apache.maven.execution.scope.internal.MojoExecutionScopeModule.configure(MojoExecutionScopeModule.java:55)
>  (via modules: org.eclipse.sisu.wire.WireModule -> 
> org.apache.maven.execution.scope.internal.MojoExecutionScopeModule)
>   while locating org.apache.maven.project.MavenProject
> 1 error
>   at 
> com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:226)
>   at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1053)
>   at 
> org.asciidoctor.maven.site.AsciidoctorDoxiaParser.parse(AsciidoctorDoxiaParser.java:78)
>   at org.apache.maven.doxia.DefaultDoxia.parse(DefaultDoxia.java:65)
> {code}
> * How to reproduce:
> # clone https://github.com/asciidoctor/asciidoctor-maven-examples
> # cd asciidoc-maven-site-example
> # mvn site:run
> # Access {{http://localhost:8080/hello.html}}
> * Env:
> {code}
> $ mvn -v
> Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 
> 2019-04-04T21:00:29+02:00)
> Maven home: /home//.sdkman/candidates/maven/current
> Java version: 1.8.0_222, vendor: AdoptOpenJDK, runtime: 
> /home/-/.sdkman/candidates/java/8.0.222.hs-adpt/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "5.1.21-1-manjaro", arch: "amd64", family: "unix
> {code}



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


[jira] [Comment Edited] (MSITE-849) Unable to inject MavenProject when using `mvn site:run`

2019-08-18 Thread Abel Salgado Romero (JIRA)


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

Abel Salgado Romero edited comment on MSITE-849 at 8/18/19 2:25 PM:


As a note to self. Directly injecting MavenProject I could narrow it to 
{{org.apache.maven.doxia.parser.manager.DefaultParserManager::getParser( String 
id)}}.
This holds a set of available Parsers, in this case the "asciidoc" parser is 
not initialized (null in the internal map), so when trying retrieve it Guice 
kicks in and initializes it, failing cause it cannot find the MavenProject in 
the context.

When running {{mvn site:site}} it is correctly retrieved.


was (Author: abel s.romero):
As a note to self. Directly injecting MavenProject I could narrow it to 
{{org.apache.maven.doxia.parser.manager.DefaultParserManager::getParser( String 
id)}}.
This holds a set of available Parsers, in this case the "asciidoc" parser is 
not initialized (null in the internal map), so when trying retrieve it Guice 
kicks in and initializes it, failing cause it cannot find the MavenProject in 
the context.

> Unable to inject MavenProject when using `mvn site:run`
> ---
>
> Key: MSITE-849
> URL: https://issues.apache.org/jira/browse/MSITE-849
> Project: Maven Site Plugin
>  Issue Type: New Feature
>Affects Versions: 3.7.1, 3.8.2
>Reporter: Abel Salgado Romero
>Assignee: Michael Osipov
>Priority: Major
>
> In https://github.com/asciidoctor/asciidoctor-maven-plugin we inject a 
> MavenProject to obtain addition configurations from the pom.xml 
> (https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/a4d86a949643ab68c124fd4c1b9b936412637d93/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java#L54).
> This works fine with {{site:site}}, but when using {{site:run}} and accessing 
> one of the Asciidoc generated pages we get the error below.
> I saw that:
> * The error occurs when trying to retrieve the instance of the MavenProject.
> * Behavior is the same if I directly inject the MavenProject instead of using 
> a provider. That is, {{site:site}} works, {{site:run}} fails because it 
> cannot find the instance.
> {code:java}
> HTTP ERROR 500
> Problem accessing /hello.html. Reason:
> Server Error
> Caused by:
> com.google.inject.ProvisionException: Unable to provision, see the following 
> errors:
> 1) Error in custom provider, com.google.inject.OutOfScopeException: Cannot 
> access Key[type=org.apache.maven.project.MavenProject, annotation=[none]] 
> outside of a scoping block
>   at 
> org.apache.maven.execution.scope.internal.MojoExecutionScopeModule.configure(MojoExecutionScopeModule.java:55)
>  (via modules: org.eclipse.sisu.wire.WireModule -> 
> org.apache.maven.execution.scope.internal.MojoExecutionScopeModule)
>   while locating org.apache.maven.project.MavenProject
> 1 error
>   at 
> com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:226)
>   at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1053)
>   at 
> org.asciidoctor.maven.site.AsciidoctorDoxiaParser.parse(AsciidoctorDoxiaParser.java:78)
>   at org.apache.maven.doxia.DefaultDoxia.parse(DefaultDoxia.java:65)
> {code}
> * How to reproduce:
> # clone https://github.com/asciidoctor/asciidoctor-maven-examples
> # cd asciidoc-maven-site-example
> # mvn site:run
> # Access {{http://localhost:8080/hello.html}}
> * Env:
> {code}
> $ mvn -v
> Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 
> 2019-04-04T21:00:29+02:00)
> Maven home: /home//.sdkman/candidates/maven/current
> Java version: 1.8.0_222, vendor: AdoptOpenJDK, runtime: 
> /home/-/.sdkman/candidates/java/8.0.222.hs-adpt/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "5.1.21-1-manjaro", arch: "amd64", family: "unix
> {code}



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


[jira] [Comment Edited] (MSITE-849) Unable to inject MavenProject when using `mvn site:run`

2019-08-18 Thread Abel Salgado Romero (JIRA)


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

Abel Salgado Romero edited comment on MSITE-849 at 8/18/19 1:50 PM:


I did debug the {{SiteRunMojo}} and the MavenProject instance gets injected but 
the thing is my class extends {{XhtmlParser}} which is a Doxia component. Which 
has no getProject().

Should I address this issue with them? There are 3 projects "Maven Doxia", 
"Maven Doxia Sitetools", "Maven Doxia Tools".


was (Author: abel s.romero):
I did debug the {{SiteRunMojo}} and the MavenProject instance gets injected but 
the thing is my class extends {{XhtmlParser}} which is a Doxia component.
Should I address this issue with them? There are 3 projects "Maven Doxia", 
"Maven Doxia Sitetools", "Maven Doxia Tools".

> Unable to inject MavenProject when using `mvn site:run`
> ---
>
> Key: MSITE-849
> URL: https://issues.apache.org/jira/browse/MSITE-849
> Project: Maven Site Plugin
>  Issue Type: New Feature
>Affects Versions: 3.7.1, 3.8.2
>Reporter: Abel Salgado Romero
>Assignee: Michael Osipov
>Priority: Major
>
> In https://github.com/asciidoctor/asciidoctor-maven-plugin we inject a 
> MavenProject to obtain addition configurations from the pom.xml 
> (https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/a4d86a949643ab68c124fd4c1b9b936412637d93/src/main/java/org/asciidoctor/maven/site/AsciidoctorDoxiaParser.java#L54).
> This works fine with {{site:site}}, but when using {{site:run}} and accessing 
> one of the Asciidoc generated pages we get the error below.
> I saw that:
> * The error occurs when trying to retrieve the instance of the MavenProject.
> * Behavior is the same if I directly inject the MavenProject instead of using 
> a provider. That is, {{site:site}} works, {{site:run}} fails because it 
> cannot find the instance.
> {code:java}
> HTTP ERROR 500
> Problem accessing /hello.html. Reason:
> Server Error
> Caused by:
> com.google.inject.ProvisionException: Unable to provision, see the following 
> errors:
> 1) Error in custom provider, com.google.inject.OutOfScopeException: Cannot 
> access Key[type=org.apache.maven.project.MavenProject, annotation=[none]] 
> outside of a scoping block
>   at 
> org.apache.maven.execution.scope.internal.MojoExecutionScopeModule.configure(MojoExecutionScopeModule.java:55)
>  (via modules: org.eclipse.sisu.wire.WireModule -> 
> org.apache.maven.execution.scope.internal.MojoExecutionScopeModule)
>   while locating org.apache.maven.project.MavenProject
> 1 error
>   at 
> com.google.inject.internal.InternalProvisionException.toProvisionException(InternalProvisionException.java:226)
>   at com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1053)
>   at 
> org.asciidoctor.maven.site.AsciidoctorDoxiaParser.parse(AsciidoctorDoxiaParser.java:78)
>   at org.apache.maven.doxia.DefaultDoxia.parse(DefaultDoxia.java:65)
> {code}
> * How to reproduce:
> # clone https://github.com/asciidoctor/asciidoctor-maven-examples
> # cd asciidoc-maven-site-example
> # mvn site:run
> # Access {{http://localhost:8080/hello.html}}
> * Env:
> {code}
> $ mvn -v
> Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 
> 2019-04-04T21:00:29+02:00)
> Maven home: /home//.sdkman/candidates/maven/current
> Java version: 1.8.0_222, vendor: AdoptOpenJDK, runtime: 
> /home/-/.sdkman/candidates/java/8.0.222.hs-adpt/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "5.1.21-1-manjaro", arch: "amd64", family: "unix
> {code}



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