-
Notifications
You must be signed in to change notification settings - Fork 1
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
Map "build" phase to asciidoctor-maven-plugin #27
Comments
The main reason is that if you define a shared configuration and several executions, an additional document corresponding to the default backend (dockbook) will be generated. |
I just tested it and that's true! We could comment that with the maven guys at https://issues.apache.org/jira/. This behavior does not make sense to me and does not match the behavior when configuring a normal plugin not mapped to lifecycle. But I see it also happens for default plugins, so I don't have much hope here, for example: <plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<executions>
<execution>
<id>custom</id>
<goals>
<goal>compile</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin> will show this in the console
Btw, Docbook won't be default backend in the next 2.0.0 release (asciidoctor/asciidoctor-maven-plugin#188). |
Note, same behavior for clean plugin :/ |
Yes, I know of that behaviour of the default plugins,but I was worried about the time needed for Asciidoc for doing a conversion not specified by the user in the configuration. |
This is what concerns me, more than time. If executions are added to the default one instead of replacing it, output will not be the expected. So we should probably stick to your original idea of NOT mapping it. |
I think this can be managed in many ways, depending of mapping or not the
In my opinionit would be more appropiate mapping the |
Already tried with skip, and did not help. It is required to set it to true in and then false in each execution, or else they inherit the value.
Not sure I follow. Everything I see seems to indicate that mapping it causes more trouble than helps, but you are implying the opposite? |
No, I am saying that the mapping should not try to fix that problem, because is not a problem of
None of the fixes goes into |
The problem is that no only this breaks backward compatibility (but this is a minor issue really), but it goes against the "convention over configuration" principle of Maven (main point for me here). |
You must understand that when I told you about a proposal, I was still thinking about the problem, so I told you only the main idea, and not the full proposal. In this case it is easy to keep backward compatibility, with a few code lines. I haven't taken a look at the
Ok, I think the same as you, but with some slight discrepancies.
Convention over configuration, but flexibility to change functionality above all.
I respect your opinion, of course, although I disagree on this: I follow this little known saying: Never let your sense of morals prevent you from doing what is right (Asimov). Please accept my apologies. It is possible that I had expressed myself wrong. I didn't mean that the plugin should be changed for requiring parameters that currently are optional. When I said :
I wanted to say that it should be studied, and after thinking a bit about it, in my opinion: If the modification is designed to keep it, for example, with a new boolean parameter named
So the plugin Now I think I would be wrong to propose this change because of the opposition seen in this informal conversation about it, even before a serious study and a full-fledged proposal. |
DISCLAIMER: when long posts appear it seems one is getting angry or something like that :P don't worry, not the case. Just trying to explain points in detail, and keep in mind that written comunication is more complicated that oral. I feel the conversation shifted. PROS
CONS
From that point, we can either decide a) not to map it or look for a b) way to disable the default execution. a) I was finally convinced not to do so, but I would really like to offer something more than an empty lifecycle. <configuration>
<skip>true</skip>
<sourceDirectory>src/docs/asciidoc</sourceDirectory>
<attributes>
<endpoint-url>http://example.org</endpoint-url>
<sourcedir>${project.build.sourceDirectory}</sourcedir>
<project-version>${project.version}</project-version>
</attributes>
</configuration>
<executions>
<execution>
<id>asciidoc-to-html</id>
<configuration>
<skip>false</skip>
<backend>html5</backend Worst case scenario, someone won't apply to the default configuration and will eventually find the error, then come to ask at the repo or check the docs to find the answer. The maven-plugin generates a line for each doc converted, so it's not hard to spot if an extra execution is being done. |
Now that you have put on the table the matter about the tone of the conversation, I consider it necessary to clarify a few questions in this regard. I am almost fifty years old.
We can both agree to repect the other's way of being and continue the collaboration or agree to settle it at this time. I beg your pardon if this speech seems aggressive to you, but I try to prevent misunderstandings in the future. |
|
About how configure the plugin to avoid the default backend generation, in my opinion we can configure one of the backends in the plugin configuration, with the default shared configuration, and the other backends in executions, overwriding the plugin configuration when necessary. With this configuration, no execution is losted (we avoid skip the main execution), and we reduce the number of executions. |
Can you provide an example? If I get it correctly that's how it is now. |
The following configuration will be valid for html and pdf (I have omitted non relevant configuration). <plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>${asciidoctor.maven.plugin.version}</version>
<configuration>
<!-- Shared configuration -->
<sourceDirectory>src/docs/asciidoc</sourceDirectory>
<sourceHighlighter>coderay</sourceHighlighter>
<!-- Specificy HTML5 configuration -->
<backend>html5</backend>
<attributes>
<!-- Shared attributes-->
<sourcedir>${project.build.sourceDirectory}</sourcedir>
<project-version>${project.version}</project-version>
<imagesdir>./images</imagesdir>
<icons>font</icons>
<!-- HTML configuration -->
<docinfo1>true</docinfo1>
<idprefix/>
<idseparator>-</idseparator>
<sectanchors>true</sectanchors>
<toc>left</toc>
</attributes>
</configuration>
<executions>
<execution>
<id>generate-pdf-doc</id>
<phase>build</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>pdf</backend>
<attributes>
<docinfo1>false</docinfo1>
<idprefix/>
<idseparator>-</idseparator>
<pagenums/>
<toc/>
<sectanchors>false</sectanchors>
</attributes>
</configuration>
</execution>
</executions>
</plugin> So instead of having a shared configuration in plugin configuration and two executions (one for HTML5 and another for pdf) we have a plugin configuration that contains the shared configuration and the HTML5 configuration, and one execution with the pdf configuration. |
That configuration is the same as I said 4 days before, in:
Originally posted by @rrialq in #27 (comment)_ |
I am aware, just want to be 100% sure. Summary: map it and document clearly that there will be an additional execution. Nothing else. |
The |
yes,it helps me <asciidoctor.maven.plugin>2.0.0-RC.1</asciidoctor.maven.plugin> flatten-maven-plugin and lifecycle-mapping thanks again! |
Regardless of how we/if we end up merging the lifecycle with the asciidoctor-maven-plugin, I am wondering if there's any reason not to have it mapped by default.
I think that it would be nice if just by adding the lifecycle one could already run
mvn build
and be able to convert some docs provided sources match with the plugin's defaults.The text was updated successfully, but these errors were encountered: