Yes, the issue was coming due to shade plugin.

By using the option
<createDependencyReducedPom>false</createDependencyReducedPom>in
shade plugin configuration solved my issue.

On Wed, Jun 17, 2020 at 12:58 AM Francois Marot <francois.ma...@gmail.com>
wrote:

> 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 <
> hanish.bansal.agar...@gmail.com>
> 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.
> >  <parent>
> >     <artifactId>test-parent</artifactId>
> >     <groupId>com.sample</groupId>
> >     <version>${revision}</version>
> >   </parent>
> >   <modelVersion>4.0.0</modelVersion>
> >   <artifactId>child1</artifactId>
> >
> > 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.
> > >  <parent>
> > >     <artifactId>test-parent</artifactId>
> > >     <groupId>com.sample</groupId>
> > >     <version>${revision}</version>
> > >   </parent>
> > >   <modelVersion>4.0.0</modelVersion>
> > >   <artifactId>child1</artifactId>
> > >
> > >
> > >
> > >
> > >
> > > On Sat, Jun 13, 2020 at 8:18 PM Tomo Suzuki <suzt...@google.com.invalid
> >
> > > 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
> > >> <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
> > >> http://maven.apache.org/xsd/maven-4.0.0.xsd";>
> > >>   <modelVersion>4.0.0</modelVersion>
> > >>   <parent>
> > >>     <groupId>com.sample</groupId>
> > >>     <artifactId>test-parent</artifactId>
> > >>     <version>${revision}</version>
> > >>   </parent>
> > >>   <artifactId>child1</artifactId>
> > >> </project>%
> > >>
> > >> 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 <version>.
> > >> >
> > >> > I just copy pasted the <build> 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.
> > >> > >
> > >> > > Steps to Reproduce the error:
> > >> > > 1. Compile test-parent project with goal "clean install". It will
> > >> compile
> > >> > > and install all child projects.
> > >> > > 2. Now compile child2 project, it would give compilation error due
> > to
> > >> > > dependency of child1 project.
> > >> > >
> > >> > >
> > >> > >
> > >> > > On Sat, Jun 13, 2020 at 12:58 AM Tomo Suzuki
> > >> <suzt...@google.com.invalid
> > >> > >
> > >> > > wrote:
> > >> > >
> > >> > > > I suspect typo in child module name. Do you want to share
> minimum
> > >> > > > reproducible project?
> > >> > > >
> > >> > > > On Fri, Jun 12, 2020 at 07:17 Hanish Bansal <
> > >> > > > hanish.bansal.agar...@gmail.com>
> > >> > > > wrote:
> > >> > > >
> > >> > > > > Yes, that has been already tried. I have installed child
> modules
> > >> > > > separately
> > >> > > > > but if there is any child module (e.g. child2) has dependency
> of
> > >> > other
> > >> > > > > child module child1 then I am not able to compile child2
> > project.
> > >> > > > >
> > >> > > > > On Fri, Jun 12, 2020 at 3:39 PM Tomo Suzuki
> > >> > <suzt...@google.com.invalid
> > >> > > >
> > >> > > > > wrote:
> > >> > > > >
> > >> > > > > > (Assuming yy-utils is the one of the child project)
> > >> > > > > > Run ”mvn install” in yy-utils module first.
> > >> > > > > >
> > >> > > > > > On Fri, Jun 12, 2020 at 01:56 Hanish Bansal <
> > >> > > > > > hanish.bansal.agar...@gmail.com>
> > >> > > > > > wrote:
> > >> > > > > >
> > >> > > > > > > Hi All,
> > >> > > > > > >
> > >> > > > > > > We have maven Multi Module Project, where we have recently
> > >> > > > implemented
> > >> > > > > > > version control process as mentioned in below
> documentation
> > >> but
> > >> > > after
> > >> > > > > > > introducing it we are not able to compile child projects
> > >> > > > independently
> > >> > > > > > > because of dependency failure.
> > >> > > > > > >
> > >> > http://maven.apache.org/maven-ci-friendly.html#multi-module-setup
> > >> > > > > > >
> > >> > > > > > > We have also used flatten-maven-plugin but artifacts
> > deployed
> > >> in
> > >> > > our
> > >> > > > > > > repository via this setup are not consumable by Maven
> > anymore.
> > >> > > > > > >
> > >> > > > > > >  <build>
> > >> > > > > > >   <plugins>
> > >> > > > > > >     <plugin>
> > >> > > > > > >       <groupId>org.codehaus.mojo</groupId>
> > >> > > > > > >       <artifactId>flatten-maven-plugin</artifactId>
> > >> > > > > > >       <version>1.1.0</version>
> > >> > > > > > >       <configuration>
> > >> > > > > > >         <updatePomFile>true</updatePomFile>
> > >> > > > > > >         <flattenMode>resolveCiFriendliesOnly</flattenMode>
> > >> > > > > > >       </configuration>
> > >> > > > > > >       <executions>
> > >> > > > > > >         <execution>
> > >> > > > > > >           <id>flatten</id>
> > >> > > > > > >           <phase>process-resources</phase>
> > >> > > > > > >           <goals>
> > >> > > > > > >             <goal>flatten</goal>
> > >> > > > > > >           </goals>
> > >> > > > > > >         </execution>
> > >> > > > > > >         <execution>
> > >> > > > > > >           <id>flatten.clean</id>
> > >> > > > > > >           <phase>clean</phase>
> > >> > > > > > >           <goals>
> > >> > > > > > >             <goal>clean</goal>
> > >> > > > > > >           </goals>
> > >> > > > > > >         </execution>
> > >> > > > > > >       </executions>
> > >> > > > > > >     </plugin>
> > >> > > > > > >   </plugins>
> > >> > > > > > >   </build>
> > >> > > > > > >
> > >> > > > > > > While trying to get artifacts, maven build failed with
> below
> > >> > error:
> > >> > > > > > >
> > >> > > > > > > Failed to read artifact descriptor for
> > >> > > > > > > org.xxxx.xxx.xxxxx:yy-utils:jar:0.0.1: Could not transfer
> > >> > artifact
> > >> > > > > > >
> > >> > > > > > > Can you please help here?
> > >> > > > > > >
> > >> > > > > > > --
> > >> > > > > > >
> > >> > > > > > > *Thanks & Regards,Hanish Bansal*
> > >> > > > > > >
> > >> > > > > > --
> > >> > > > > > Regards,
> > >> > > > > > Tomo
> > >> > > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > > --
> > >> > > > >
> > >> > > > > *Thanks & Regards,Hanish Bansal*
> > >> > > > > Lead Software Engineer, Big Data
> > >> > > > > (M) : +91-995-339-9925
> > >> > > > > LinkedIn: www.linkedin.com/in/hanishbansal/
> > >> > > > >
> > >> > > > --
> > >> > > > Regards,
> > >> > > > Tomo
> > >> > > >
> > >> > >
> > >> > >
> > >> > > --
> > >> > >
> > >> > > *Thanks & Regards,Hanish Bansal*
> > >> > > Lead Software Engineer, Big Data
> > >> > > (M) : +91-995-339-9925
> > >> > > LinkedIn: www.linkedin.com/in/hanishbansal/
> > >> > >
> > >> >
> > >>
> > >>
> > >> --
> > >> Regards,
> > >> Tomo
> > >>
> > >
> > >
> > > --
> > >
> > > *Thanks & Regards,Hanish Bansal*
> > > Lead Software Engineer, Big Data
> > > (M) : +91-995-339-9925
> > > LinkedIn: www.linkedin.com/in/hanishbansal/
> > >
> >
> >
> > --
> >
> > *Thanks & Regards,Hanish Bansal*
> > Lead Software Engineer, Big Data
> > (M) : +91-995-339-9925
> > LinkedIn: www.linkedin.com/in/hanishbansal/
> >
>


-- 

*Thanks & Regards,Hanish Bansal*
Lead Software Engineer, Big Data
(M) : +91-995-339-9925
LinkedIn: www.linkedin.com/in/hanishbansal/

Reply via email to