Skip to content

Fixes for Maven POM, and a modularization patch #23

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

Closed
wants to merge 27 commits into from
Closed

Fixes for Maven POM, and a modularization patch #23

wants to merge 27 commits into from

Conversation

carlosame
Copy link

Fixes: 7b05376

@carlosame
Copy link
Author

carlosame commented Jul 5, 2020

My validator-nu branch contains several patches related to the POM file, and finally a patch for modularization. The first patch fixes a broken build and should be taken for 2.0 regardless of the other ones.

EDIT: the first patch fixes a broken build for Java 8. Given that the last patch requires JDK 12 or higher, it is not necessary (but does not hurt either).

@carlosame carlosame changed the title Fix broken Maven build due to maven-antrun-plugin being unable to locate javac Fixes for Maven POM, and a modularization patch Jul 5, 2020
@carlosame
Copy link
Author

One point that I wanted to make: this set of patches includes configuration to build a source and javadoc artifacts, while the previous POM asked to specify that as a command line option (the POM was not set up for that). However, due to a bug in the javadoc of recent JDKs that command line would fail (unless one puts a load of configuration options in the command line), and this is the reason for the change.

The section for building the source artifact could be removed though.

@anthonyvdotbe
Copy link
Contributor

There's several issues with the module descriptor:

  • it exports all packages
  • it forces every user of the module to provide all of nu.xom, com.ibm.icu and jchardet as well, even if it doesn't actually use any of them
  • jchardet shouldn't be required at all

@carlosame
Copy link
Author

* it exports all packages

I did not like exporting a package called impl either, but from looking at it I cannot guarantee that nobody is using it. If @hsivonen believes that some package should not be exported, in August or September we should have plenty of time to discuss that.

* it forces every user of the module to provide all of `nu.xom`, `com.ibm.icu` and `jchardet` as well, even if it doesn't actually use any of them

Concerning ICU4J and jchardet, they could be declared static (if that is what you mean) but I do not know whether they could be instantiated as a result of a parsing decision (as opposed to a specific usage by the developer). XOM objects are part of the public API, but could be left static as well.

* `jchardet` shouldn't be required at all

It is required but could be changed to a static requirement.

@carlosame
Copy link
Author

I changed nu.xom, com.ibm.icu and jchardet to static dependencies, we can always switch back.

@sideshowbarker
Copy link
Member

sideshowbarker commented Jul 6, 2020

I added 651e417 — because without it, I get a few dozen errors about javadoc problems:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.1.0:jar (attach-javadocs) on project htmlparser: MavenReportException: Error while generating Javadoc:
[ERROR] Exit code: 1 - /Users/mike/workspace/validator/htmlparser/target/src/nu/validator/htmlparser/common/ByteReadable.java:41: warning: no description for @throws
[ERROR]      * @throws IOException
[ERROR]        ^
[ERROR] /Users/mike/workspace/validator/htmlparser/target/src/nu/validator/htmlparser/common/TokenHandler.java:182: warning: no @throws for org.xml.sax.SAXException
[ERROR]     public void ensureBufferSpace(int inputLength) throws SAXException;
[ERROR]                 ^
…

@sideshowbarker
Copy link
Member

sideshowbarker commented Jul 6, 2020

When running mvn package in this branch, I’m getting this non-fatal error:

[INFO] --- maven-javadoc-plugin:3.1.0:jar (attach-javadocs) @ htmlparser ---
[ERROR] Error fetching link: /Users/mike/workspace/validator/htmlparser/target/javadoc-bundle-options. Ignored it.

Given that it’s non-fatal and only related to the javadoc build, I don’t think we need to care much about it — but it’d be nice to get rid of that error if we can.

Any clues about what might be causing it?

@carlosame
Copy link
Author

Any clues about what might be causing it?

It is a known bug with a few variants being reported, like:

https://issues.apache.org/jira/browse/MJAVADOC-623

In recent years, the production of javadocs with Maven -especially with modular JDKs- is a mess of bugs, with newer versions of maven-javadoc-plugin fixing things but at the same time breaking other stuff (for example some fix breaks modular projects, and then the fixed version breaks usage with Java 8, etc.)

We can be happy that with plugin version 3.1.0 the jar is at least built (it fails with 3.2.0 and the same happens in other projects).

sideshowbarker and others added 18 commits August 11, 2020 02:03
Also allow `<!-->` at (IE conditional) comment end

See whatwg/html#1356
See whatwg/html#1456
Doing `errUnclosedElements(eltPos, "template")` for EOF in the “in
template” state results in the error message “End tag `template` seen, but
there were open elements”, which is all wrong because the actual problem is
that though a `template` end tag was expected, EOF was reached without a
`template` end tag being seen.

So let’s instead when we reach this just report the list of open elements.
When the parser encounters a `</template>` end tag and there are other
open elements, the HTML spec requires the parser to “generate all
implied end tags thoroughly”, which unlike “generate implied end tags”
also includes generating implied end tags for table-parts elements
(caption, colgroup, tbody, thead, tfoot, td, th, and tr).
This refines 9ce4bd4 by only buffering if we’re actually inside an
attribute value.
carlosame and others added 7 commits August 12, 2020 06:36
- Update the file description.
- Enforce the usage of UTF-8 encoding (instead of platform-dependent).
- Build source and javadoc packages.
- Set specific versions for plugins.
- Omit the Maven descriptor in the Jar file (which was lost in 2e8c502).
Not required for modularization, but no reason to stay on the old version.
Requires JDK 12 or higher (due to bug in JDK 11), but produces bytecode for
Java 7 and 11.
Without this change, the Maven javadoc build fails with fatal errors.
@sideshowbarker sideshowbarker force-pushed the validator-nu branch 3 times, most recently from 0018e61 to c37a9da Compare August 22, 2020 20:21
@sideshowbarker sideshowbarker deleted the branch validator:validator-nu September 2, 2021 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants