I had to play with optional to have the dependency not picked up internally.
It would be a lot easier if shaded worked internally without requiring a downstream dependency. As a matter of fact, I just looked on Netty, and they shade org.jctools into netty-common, which is the same pattern that I'm after, and they also have the same issue in there. On Wed, Nov 17, 2021 at 9:07 AM Clebert Suconic <clebert.suco...@gmail.com> wrote: > > Right.. This should happen by default. and it will only work if I'm > using the shaded jar outside of my project. However if I use it within > my project it will not work at all. > > > I have created a minimal version of my issue on this github project: > > > https://github.com/clebertsuconic/clebert-shade-issue > > > > I expect the following line to give me a compilation error: > > https://github.com/clebertsuconic/clebert-shade-issue/blob/main/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/JsonLoader.java#L38 > > > And that shading isolation will only work (that means give me the > compilation error) if I remove this line from the main pom (after mvn > install on artemis-commons-json of course): > > https://github.com/clebertsuconic/clebert-shade-issue/blob/main/pom.xml#L34 > > > if I also call "mvn dependency:tree", you will see the dependency > listed and not giving the isolation I expected: > > https://gist.github.com/clebertsuconic/cb025175470a0f429582d3f656b48377#file-gistfile1-txt-L5-L6 > > > > > > So, in other words, shading does not work internally. The pom > replacement will not work through the internal dependency list. > > It seems like a bug to me, unless someone finds an explanation? > > and how I would be able to achieve this? would anybody know? > > On Wed, Nov 17, 2021 at 8:39 AM Matt Benson <mben...@apache.org> wrote: > > > > https://maven.apache.org/plugins/maven-shade-plugin/shade-mojo.html#createDependencyReducedPom > > > > On Tue, Nov 16, 2021, 10:47 PM Clebert Suconic <clebert.suco...@gmail.com> > > wrote: > > > > > I’m not sure how you mean. > > > > > > Just get the Pom at the source level or am intermediate build process ? > > > > > > > > > How to do that ? > > > > > > On Tue, Nov 16, 2021 at 11:34 PM Matt Benson <mben...@apache.org> wrote: > > > > > > > You probably want to rewrite the pom, using the property provided by the > > > > shade goal for this purpose. > > > > > > > > Matt > > > > > > > > On Tue, Nov 16, 2021, 7:48 PM Clebert Suconic <clebert.suco...@gmail.com > > > > > > > > wrote: > > > > > > > > > I am trying to create a component within ActiveMQ Artemis that would > > > > > shade johnzon and javax.json. > > > > > > > > > > That component should then be used by other components within Artemis. > > > > > > > > > > I'm doing that because some users want to use javax.json and others > > > > > want to use jakarta.json on their runtimes. Since we only use json > > > > > internally I am trying to shade our own usage and not relay on either > > > > > one of these package names. > > > > > > > > > > > > > > > However I'm getting crazy on this. I can't make shade to hide the > > > > > dependency. mvn dependency:tree still shows the libraries. and shade > > > > > will not work if I make them provided.e. > > > > > > > > > > > > > > > What is the right way to shade within my own project? > > > > > > > > > > > > > > > I have the project available on my own github fork here: > > > > > > > > > > https://github.com/clebertsuconic/activemq-artemis/tree/commons-json > > > > > > > > > > (type this if you can download my branch: > > > > > > > > > > git clone https://github.com/clebertsuconic/activemq-artemis.git > > > > > cd activemq-artemis > > > > > git clone commons-json > > > > > mvn install -DskipTests=true > > > > > mvn dependency:tree > > > > > > > > > > and here is what gets interesting. > > > > > if I go to artemis-selector (a package that relied on > > > > > artemis-commons-json) and type mvn dependency:tree on that package, > > > > > the dependency does not show up. > > > > > > > > > > > > > > > The issue is only when building the whole project... > > > > > > > > > > > > > > > and I have played with quite a few options! ) > > > > > > > > > > > > > > > > > > > > Any help would be appreciated ! :) > > > > > > > > > > > > > > > Thanks > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > > > > > For additional commands, e-mail: users-h...@maven.apache.org > > > > > > > > > > > > > > > > > -- > > > Clebert Suconic > > > > > > > -- > Clebert Suconic -- Clebert Suconic --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org