-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support CDATA section in ConfigurationBuilder #1260
Comments
Thanks for the suggestion, but I am not sure that I understand what you are trying to do from what you have described thus far. Can you please provide an example? Ideally one that shows the code you are using, the output that you expect and the actual output that you currently get. |
For example: <plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<configuration>
<java>
<licenseHeader>
<content></content>
</licenseHeader>
</java>
</configuration>
</plugin> I want to add the |
And,
I also want to be able to control the |
How does this relate to inserting CDATA? I'm struggling to see the connection. |
Sorry, this may be another question. But I think this may be due to the method |
The problem is that something like this doesn't work: build.plugins().add("com.diffplug.spotless", "spotless-maven-plugin", (plugin) -> {
plugin.configuration((configuration) -> {
configuration.add("java", (java) -> {
java.add("licenseHeader", (licenseHeader) -> {
licenseHeader.add("content", """
<![CDATA[
Copyright 2012-2023 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl
See the License for the specific language governing permissions and
limitations under the License.
]]>""");
});
});
});
}); This creates a XML looking like this: <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.demo</groupId>
<artifactId>demo</artifactId>
<version>1.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<configuration>
<java>
<licenseHeader>
<content><![CDATA[
Copyright 2012-2023 the original author or authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl
See the License for the specific language governing permissions and
limitations under the License.
]]></content>
</licenseHeader>
</java>
</configuration>
</plugin>
</plugins>
</build>
</project> |
We need to use the original content of the XML in the plugin configuration buider, but when I use
MavenPlugin.ConfigurationBuilder#add(name, xml)
, the content of xml will be escapedThe text was updated successfully, but these errors were encountered: