beware of a caveat when using flatten and shade plugins:
https://github.com/mojohaus/flatten-maven-plugin/issues/100 &
https://stackoverflow.com/questions/52552329/use-maven-flatten-plugin-and-maven-shade-plugin-at-the-same-time
Basically you have to make sure that flatten is plugged AFTER shade in the
Maven lifecycle.
I recently faced the problem ;) :
https://twitter.com/FrancoisMarot/status/1263028183047299072
*- - - - -François Marot06 50 91 96 38*
On Tue, 16 Jun 2020 at 07:41, Hanish Bansal
wrote:
> Still facing the same issue.
>
> Child project1 has shade plugin dependency in pom.xml.
>
> *Steps to reproduce the error:*
> 1. Compile external project
> https://github.com/hanishbansal/external-common ,
> this is some external project in which we can not change anything.
> 2. Our project "test-parent" has dependency of "external-common" project.
> Now checkout code from https://github.com/hanishbansal/test-parent adn try
> to compile it. Module "child1" is not deployed properly in local maven
> repo.
> Below is pom snippet of child1 module where revision tag is not replaced.
>
> test-parent
> com.sample
> ${revision}
>
> 4.0.0
> child1
>
> On Mon, Jun 15, 2020 at 10:37 AM Hanish Bansal <
> hanish.bansal.agar...@gmail.com> wrote:
>
> > Hi All,
> >
> > Thanks for your response.
> >
> > I have replicated the same issue as mentioned in below steps:
> > 1. Compile external project
> > https://github.com/hanishbansal/external-common , this is some external
> > project in which we can not change anything.
> > 2. Our project "test-parent" has dependency of "external-common" project.
> > Now checkout code from https://github.com/hanishbansal/test-parent adn
> > try to compile it. Module "child1" is not deployed properly in local
> maven
> > repo.
> > Below is pom snippet of child1 module where revision tag is not replaced.
> >
> > test-parent
> > com.sample
> > ${revision}
> >
> > 4.0.0
> > child1
> >
> >
> >
> >
> >
> > On Sat, Jun 13, 2020 at 8:18 PM Tomo Suzuki
> > wrote:
> >
> >> Hi Hanish,
> >>
> >> I see child1 in my Maven local repository cannot resolve the $version to
> >> refer to its parent, because $version is defined at the parent (the
> error
> >> message below).
> >>
> >> How about specifying the concrete version when specifying parent? While
> >> you
> >> might not like that the version value will appear multiple places, you
> can
> >> update them by "mvn version:set"
> >> https://www.mojohaus.org/versions-maven-plugin/set-mojo.html
> >>
> >>
> >> [ERROR] Failed to execute goal on project child2: Could not resolve
> >> dependencies for project com.sample:child2:jar:1.1.0-SNAPSHOT: Failed to
> >> collect dependencies at com.sample:child1:jar:1.1.0-SNAPSHOT: Failed to
> >> read artifact descriptor for com.sample:child1:jar:1.1.0-SNAPSHOT: Could
> >> not find artifact com.sample:test-parent:pom:${revision} in central (
> >> https://repo.maven.apache.org/maven2) -> [Help 1]
> >> [ERROR]
> >> [ERROR] To see the full stack trace of the errors, re-run Maven with the
> >> -e
> >> switch.
> >> [ERROR] Re-run Maven using the -X switch to enable full debug logging.
> >> [ERROR]
> >> [ERROR] For more information about the errors and possible solutions,
> >> please read the following articles:
> >> [ERROR] [Help 1]
> >>
> >>
> http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
> >>
> >> /tmp/test-parent/child2 $ cat
> >>
> >>
> ~/.m2/repository/com/sample/child1/1.1.0-SNAPSHOT/child1-1.1.0-SNAPSHOT.pom
> >> 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
> >> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
> >> 4.0.0
> >>
> >> com.sample
> >> test-parent
> >> ${revision}
> >>
> >> child1
> >> %
> >>
> >> On Sat, Jun 13, 2020 at 8:41 AM Francois Marot <
> francois.ma...@gmail.com>
> >> wrote:
> >>
> >> > Hello,
> >> > I can confirm that you sample project works as intended once you add
> the
> >> > missing configuration for the flatten plugin. Without it the pom.xml
> >> > installed in your local repo are not correct because of the
> >> placeholders in
> >> > the .
> >> >
> >> > I just copy pasted the content as explained here:
> >> > http://maven.apache.org/maven-ci-friendly.html#install-deploy
> >> >
> >> > Hope you will soon make it work
> >> >
> >> >
> >> >
> >> > *- - - - -François Marot06 50 91 96 38*
> >> >
> >> >
> >> >
> >> > On Sat, 13 Jun 2020 at 05:39, Hanish Bansal <
> >> > hanish.bansal.agar...@gmail.com>
> >> > wrote:
> >> >
> >> > > Hi Team,
> >> > >
> >> > > I have pushed a sample minimal project in git at the following link
> >> > > https://github.com/hanishbansal/test-parent
> >> > >
> >> > > Project Structure:
> >> > > test-parent
> >> > >- child1
> >> > >- child2
> >> > >
> >> > > child2 project has dependency of child1 project.
> >> > >
> >> > > S