question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Maven generate-sources HtmlPolicy

See original GitHub issue

Hi, is it possible to use a custom HtmlPolicy when using the maven plugin to generate sources during build? I want to package the templates with my application (like this: https://github.com/casid/jte/blob/master/DOCUMENTATION.md#using-the-application-class-loader-since-120) As I am using Html Attributes without a value for testing (i.e. <div data-test-important-content>) I have to use a custom policy. Unfortunately my build is breaking because of the failed policy:

Failed to execute goal gg.jte:jte-maven-plugin:1.5.0:generate (default) on project service-frontend: 
Execution default of goal gg.jte:jte-maven-plugin:1.5.0:generate failed: 
Failed to compile tag/shop/communication.jte, error at line 1: Unquoted HTML attribute values are not allowed: data-test-shop-communication

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kelunikcommented, Feb 2, 2021

@Fender123 Unquoted attributes without value should be allowed for all attributes, so e.g. <input disabled> should be allowed, too.

The feature is intended to make the automatic attribute escaping less complex by not having to support various escaping mechanism based on quoting. If attributes do not contain variables, it’s probably OK to allow those, too, so e.g. <input value=foo>, but AFAIK most people default to quoting always.

1reaction
michael-madercommented, Feb 3, 2021

ok, thanks for the clarification.

Yes I experienced same strange hot reloading behavior, but not always…

Maybe I should have a look into CompilerMojo as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven: How to handle generated sources for test(only)?
1 Answer 1 ... It ensures that the directories added by this goal will be picked up automatically by the compiler plugin during...
Read more >
Guide to generating Sources - Apache Maven
To generate sources you must first have a plugin that participates in the generate-sources phase like the ANTLR4 Maven Plugin.
Read more >
jte/DOCUMENTATION.md at main · casid/jte - GitHub
The plugin generates *.java files for all jte templates during Maven's ... like configuring a custom HtmlPolicy class (this is because project classes...
Read more >
5. User and Programmers Guide - AuthzForce - Read the Docs
Run Maven generate-sources . This will generate the JAXB-annotated class(es) from the XML schema into the folder ...
Read more >
com.googlecode.owasp-java-html-sanitizer - Maven Repository
Takes third-party HTML and produces HTML that is safe to embed in your web application. Fast and easy to configure. License, Apache 2.0....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found