-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Relocate XSD in XML #6
Comments
@melloware makes sense for me (even if it should be useless for javax -> jakarta since EE servers must support both). Do you want to do a PR of a new transformer? Can probably start with a plain string replacer impl. |
Yep let me see what I can come up with. |
@melloware any news on that? @Vlatombe just did a PR in 0.0.2 version which eases xml replacements using string replacements so guess it can be "solved"? |
Oh awesome!!! Yes this can be solved . I totally forgot about this ticket :) |
@rmannibucau When I try and replace <relocation>
<pattern>http://java.sun.com/xml/ns/javaee</pattern>
<shadedPattern>https://jakarta.ee/xml/ns/jakartaee</shadedPattern>
</relocation> It comes out incorrectly like this... <faces-config xmlns="https:..jakarta.ee.xml.ns.jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="https:..jakarta.ee.xml.ns.jakartaee https:..jakarta.ee.xml.ns.jakartaee/web-facesconfig_2_0.xsd"> it looks like the slashes are turned to "." is there some escaping I am missing? |
@melloware did you use RelocationTransformer or SourceRelocationTransformer? Also wonder if you tried escaping the slack in pattern? |
Let me try the |
|
1 similar comment
|
@melloware path transformer should enable you to reach what you want, can even use rawString option of the relocator configuration. |
Nice i will give it a shot when you publish 0.3! |
done, should sync on central soon |
@rmannibucau sorry but I can't get this to work at all. <transformer implementation="io.yupiik.maven.shade.transformer.PathRelocationTransformer">
<delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>META-INF/faces-config.xml</resource>
</transformer>
</delegates>
</transformer>
...
<relocations>
<relocation>
<pattern>http://java.sun.com/xml/ns/javaee</pattern>
<shadedPattern>https://jakarta.ee/xml/ns/jakartaee</shadedPattern>
</relocation>
</relocations> Is not transforming anything now. Its like its not picking up the relocations values at all now? |
@melloware idea is Line 42 in 994e848
<rawString>true</> in relocation
|
OK I added <relocation>
<pattern>http://java.sun.com/xml/ns/javaee</pattern>
<shadedPattern>https://jakarta.ee/xml/ns/jakartaee</shadedPattern>
<rawString>true</rawString>
</relocation> But now it errors with "[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (jakarta) on project primefaces: Error creating shaded jar: Problem shading JAR C:\dev\primefaces\primefaces-melloware\primefaces\target\primefaces-12.0.0-SNAPSHOT.jar entry META-INF/MANIFEST.MF: java.lang.NullPointerException" IF I remove RawString it works but then doesn't relocate. here is my full config of what we are trying to accomplish... <executions>
<execution>
<id>shade-dependencies</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
<execution>
<id>jakarta</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>jakarta</shadedClassifierName>
<createDependencyReducedPom>false</createDependencyReducedPom>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="io.yupiik.maven.shade.transformer.PathRelocationTransformer">
<delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>META-INF/faces-config.xml</resource>
</transformer>
</delegates>
</transformer>
<transformer implementation="io.yupiik.maven.shade.transformer.RelocationTransformer">
<delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>META-INF/primefaces-p.taglib.xml</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/resources/primefaces/ajaxstatus/ajaxstatus.js</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/resources/primefaces/core.js</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/resources/primefaces/core/core.js</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/resources/primefaces/core/core.ajax.js</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/resources/primefaces/core/core.csp.js</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/resources/primefaces/validation/validation.js</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/resources/primefaces/validation/validation.bv.js</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/resources/primefaces/fileupload/fileupload.js</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/resources/primefaces/lifecycle/lifecycle.js</resource>
</transformer>
</delegates>
</transformer>
</transformers>
<artifactSet>
<includes>
<include>${project.groupId}:${project.artifactId}</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>http://java.sun.com/xml/ns/javaee</pattern>
<shadedPattern>https://jakarta.ee/xml/ns/jakartaee</shadedPattern>
<rawString>true</rawString>
</relocation>
<relocation>
<pattern>javax.faces</pattern>
<shadedPattern>jakarta.faces</shadedPattern>
</relocation>
<relocation>
<pattern>javax.el</pattern>
<shadedPattern>jakarta.el</shadedPattern>
</relocation>
<relocation>
<pattern>javax.annotation</pattern>
<shadedPattern>jakarta.annotation</shadedPattern>
</relocation>
<relocation>
<pattern>javax.servlet</pattern>
<shadedPattern>jakarta.servlet</shadedPattern>
</relocation>
<relocation>
<pattern>javax.persistence</pattern>
<shadedPattern>jakarta.persistence</shadedPattern>
</relocation>
<relocation>
<pattern>javax.enterprise</pattern>
<shadedPattern>jakarta.enterprise</shadedPattern>
</relocation>
<relocation>
<pattern>javax.xml.bind</pattern>
<shadedPattern>jakarta.xml.bind</shadedPattern>
</relocation>
<relocation>
<pattern>javax.validation</pattern>
<shadedPattern>jakarta.validation</shadedPattern>
</relocation>
<relocation>
<pattern>javax.inject</pattern>
<shadedPattern>jakarta.inject</shadedPattern>
</relocation>
<relocation>
<pattern>javax.activation</pattern>
<shadedPattern>jakarta.activation</shadedPattern>
</relocation>
<relocation>
<pattern>javax.ws.rs</pattern>
<shadedPattern>jakarta.ws.rs</shadedPattern>
</relocation>
<relocation>
<pattern>javax.jws</pattern>
<shadedPattern>jakarta.jws</shadedPattern>
</relocation>
<relocation>
<pattern>javax.cache</pattern>
<shadedPattern>jakarta.cache</shadedPattern>
</relocation>
<relocation>
<pattern>javax.xml.ws</pattern>
<shadedPattern>jakarta.xml.ws</shadedPattern>
</relocation>
<relocation>
<pattern>javax.xml.soap</pattern>
<shadedPattern>jakarta.xml.soap</shadedPattern>
</relocation>
<relocation>
<pattern>window.jsf</pattern>
<shadedPattern>window.faces</shadedPattern>
</relocation>
<relocation>
<pattern>jsf.ajax</pattern>
<shadedPattern>faces.ajax</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions> |
@melloware can you run with |
|
hmm, looks like RelocationTransformer is not compatible with rawString, can you try to move to source one for this one (and keep path one first)? |
I apologize i am not quite sure what you mean? I was hoping the relocations could be declared per transformer but I don't think they can? |
|
OK I assumed this is what you mean move <transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="io.yupiik.maven.shade.transformer.PathRelocationTransformer">
<delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>META-INF/faces-config.xml</resource>
</transformer>
</delegates>
</transformer>
<transformer implementation="io.yupiik.maven.shade.transformer.SourceRelocationTransformer">
<delegates>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"/>
</delegates>
</transformer> |
@melloware can you push the project somewhere? |
Yeah just clone https://github.com/primefaces/primefaces Then you will find our current shading in You can run |
@melloware guess you hit apache/maven-shade-plugin#123, it is a bug which affects the manifest transformer and more generally transformers using relocateClass without protection, did you try to not use it (maybe a plain text transformer or alike just to test)? I will add to this project the protection but manifest transformer will have the bug until shade plugin is re-released. |
awesome work @rmannibucau i am monitoring that ticket and PR. I think we need the Manifest transformer since all the classes for Java 9 modules get listed in the manifest for the Felix bundler and must be converted from javax. to jakarta. so I think I just have to wait until that SHADE bug is fixed. |
@melloware well if it is just about replacing in manifest, any passthrough transformer would work and it would enable to workaround current maven-shade-plugin limitation |
Sorry I am definitely no expert in this but if I pull the ManifestTransformer out I just hit the next error:
|
@melloware idea was to use workaround by replacing ManifestTransformer by another transformer where relocation of the wrapper would work and wouldn't conflict with the bug in the relocation of the transformer itself. Now if shade patch works for you I guess there is no need to investigate this option too if nothing urges. |
We currently use this plugin to shade PrimeFaces for a Jakarta EE version to convert
javax
tojakarta
files.But we have this open ticket it would be great to be able to replace XSD definitions inside XML files.
See: primefaces/primefaces#7087
The text was updated successfully, but these errors were encountered: