Re: Merged configuration between parent & child?

2020-10-15 Thread Jörg Schaible
If you put your configuration additionally into a profile in the parent, that is
activated e.g. on the existence of the file "profiles/lombok". Then you can
simply create that in those child projects individually that use the
processor. Personally I share typically the profile's name with the one of the
file in the profiles directory...

On Thursday, 15. October 2020, 13:24:41 CEST Andres Almiray wrote:
> Thank you Anders, the `combine.children="append"` attribute applied to the
> child's  element does the trick.
>
> Wonderful!
>
> On Thu, Oct 15, 2020 at 12:54 PM Anders Hammar  wrote:
> > Maybe this blog post helps:
> >
> > https://blog.sonatype.com/2011/01/maven-how-to-merging-plugin-configuratio
> > n-in-complex-projects/
> >
> > /Anders
> >
> > On Thu, Oct 15, 2020 at 12:25 PM Andres Almiray 
> >
> > wrote:
> > > Hello everyone,
> > >
> > > I wonder if it's possible to define a plugin's configuration on both
> >
> > parent
> >
> > > & child in such a way that the resulting configuration is merged, first
> > > the  parent's then the child's. My use case is defining a set of
> >
> > annotation
> >
> > > processors in the maven-compiler-plugin at the parent, also adding
> >
> > another
> >
> > > set in the child's maven-compiler-plugin.
> > >
> > > The following example is NOT explicitly related to Lombok nor AutoValue,
> > > they are used just as reference. Suggestions to skip Lombok and/or
> > > AutoValue are not needed, thanks.
> > >
> > > Given a parent pom such as
> > >
> > > 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.acme
> > > parent
> > > 0.0.0
> > > pom
> > >
> > > 
> > >
> > > 1.7.4
> > > 1.18.14
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > >   org.apache.maven.plugins
> > >   maven-compiler-plugin
> > >   3.8.1
> > >   
> > >
> > >   
> > >
> > >   
> > >
> > >   org.projectlombok
> > >   lombok
> > >   1.18.14
> > >
> > >   
> > >
> > >   
> > >
> > >   
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > And a child pom as
> > >
> > > 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.acme
> > > parent
> > > 0.0.0
> > >
> > > 
> > >
> > > child
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > >   org.apache.maven.plugins
> > >   maven-compiler-plugin
> > >   3.8.1
> > >   true
> > >   
> > >
> > >   
> > >
> > >   
> > >
> > >   com.google.auto.value
> > >   auto-value
> > >   ${auto-value.version}
> > >
> > >   
> > >
> > >   
> > >
> > >   
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > 
> > >
> > > The desired result when evaluating the child's pom is to have both
> > > Lombok
> > > and AutoValue (in that order) in the compiler's configuration. As it
> > > currently stands with Maven 3.6.3 only the child configuration is
> > > available, as shown by running `mvn help:effective-pom`
> > >
> > >   
> > >
> > > maven-compiler-plugin
> > > 3.8.1
> > > 
> > >
> > >   
> > >
> > > default-compile
> > > compile
> > > 
> > >
> > >   compile
> > >
> > > 
> > > 
> > >
> > >   
> > >
> > > 
> > >
> > >   com.google.auto.value
> > >   auto-value
> > >   1.7.4
> > >
> > > 
> > >
> > >   
> > >
> > > 
> > >
> > >   
> > >   
> > >
> > > default-testCompile
> > > test-compile
> > > 
> > >
> > >   testCompile
> > >
> > > 
> > > 
> > >
> > >   
> > >
> > > 
> > >
> > >   com.google.auto.value
> > >   auto-value
> > >   1.7.4
> > >
> > > 
> > >
> > >   
> > >
> > > 
> > >
> > >   
> > >
> > > 
> > > true
> > 

Re: Merged configuration between parent & child?

2020-10-15 Thread Andres Almiray
Thank you Anders, the `combine.children="append"` attribute applied to the
child's  element does the trick.

Wonderful!

On Thu, Oct 15, 2020 at 12:54 PM Anders Hammar  wrote:

> Maybe this blog post helps:
>
> https://blog.sonatype.com/2011/01/maven-how-to-merging-plugin-configuration-in-complex-projects/
>
> /Anders
>
> On Thu, Oct 15, 2020 at 12:25 PM Andres Almiray 
> wrote:
>
> > Hello everyone,
> >
> > I wonder if it's possible to define a plugin's configuration on both
> parent
> > & child in such a way that the resulting configuration is merged, first
> > the  parent's then the child's. My use case is defining a set of
> annotation
> > processors in the maven-compiler-plugin at the parent, also adding
> another
> > set in the child's maven-compiler-plugin.
> >
> > The following example is NOT explicitly related to Lombok nor AutoValue,
> > they are used just as reference. Suggestions to skip Lombok and/or
> > AutoValue are not needed, thanks.
> >
> > Given a parent pom such as
> >
> > 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.acme
> > parent
> > 0.0.0
> > pom
> >
> > 
> > 1.7.4
> > 1.18.14
> > 
> >
> > 
> > 
> > 
> > 
> >   org.apache.maven.plugins
> >   maven-compiler-plugin
> >   3.8.1
> >   
> >   
> >   
> >   org.projectlombok
> >   lombok
> >   1.18.14
> >   
> >   
> >   
> > 
> > 
> > 
> > 
> > 
> >
> > And a child pom as
> >
> > 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.acme
> > parent
> > 0.0.0
> > 
> >
> > child
> >
> > 
> > 
> > 
> >   org.apache.maven.plugins
> >   maven-compiler-plugin
> >   3.8.1
> >   true
> >   
> >   
> >   
> >   com.google.auto.value
> >   auto-value
> >   ${auto-value.version}
> >   
> >   
> >   
> > 
> > 
> > 
> > 
> >
> > The desired result when evaluating the child's pom is to have both Lombok
> > and AutoValue (in that order) in the compiler's configuration. As it
> > currently stands with Maven 3.6.3 only the child configuration is
> > available, as shown by running `mvn help:effective-pom`
> >
> >   
> > maven-compiler-plugin
> > 3.8.1
> > 
> >   
> > default-compile
> > compile
> > 
> >   compile
> > 
> > 
> >   
> > 
> >   com.google.auto.value
> >   auto-value
> >   1.7.4
> > 
> >   
> > 
> >   
> >   
> > default-testCompile
> > test-compile
> > 
> >   testCompile
> > 
> > 
> >   
> > 
> >   com.google.auto.value
> >   auto-value
> >   1.7.4
> > 
> >   
> > 
> >   
> > 
> > true
> > 
> >   
> > 
> >   com.google.auto.value
> >   auto-value
> >   1.7.4
> > 
> >   
> > 
> >   
> >
> > Cheers,
> > Andres
> >
>


Re: Merged configuration between parent & child?

2020-10-15 Thread Anders Hammar
Maybe this blog post helps:
https://blog.sonatype.com/2011/01/maven-how-to-merging-plugin-configuration-in-complex-projects/

/Anders

On Thu, Oct 15, 2020 at 12:25 PM Andres Almiray  wrote:

> Hello everyone,
>
> I wonder if it's possible to define a plugin's configuration on both parent
> & child in such a way that the resulting configuration is merged, first
> the  parent's then the child's. My use case is defining a set of annotation
> processors in the maven-compiler-plugin at the parent, also adding another
> set in the child's maven-compiler-plugin.
>
> The following example is NOT explicitly related to Lombok nor AutoValue,
> they are used just as reference. Suggestions to skip Lombok and/or
> AutoValue are not needed, thanks.
>
> Given a parent pom such as
>
> 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.acme
> parent
> 0.0.0
> pom
>
> 
> 1.7.4
> 1.18.14
> 
>
> 
> 
> 
> 
>   org.apache.maven.plugins
>   maven-compiler-plugin
>   3.8.1
>   
>   
>   
>   org.projectlombok
>   lombok
>   1.18.14
>   
>   
>   
> 
> 
> 
> 
> 
>
> And a child pom as
>
> 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.acme
> parent
> 0.0.0
> 
>
> child
>
> 
> 
> 
>   org.apache.maven.plugins
>   maven-compiler-plugin
>   3.8.1
>   true
>   
>   
>   
>   com.google.auto.value
>   auto-value
>   ${auto-value.version}
>   
>   
>   
> 
> 
> 
> 
>
> The desired result when evaluating the child's pom is to have both Lombok
> and AutoValue (in that order) in the compiler's configuration. As it
> currently stands with Maven 3.6.3 only the child configuration is
> available, as shown by running `mvn help:effective-pom`
>
>   
> maven-compiler-plugin
> 3.8.1
> 
>   
> default-compile
> compile
> 
>   compile
> 
> 
>   
> 
>   com.google.auto.value
>   auto-value
>   1.7.4
> 
>   
> 
>   
>   
> default-testCompile
> test-compile
> 
>   testCompile
> 
> 
>   
> 
>   com.google.auto.value
>   auto-value
>   1.7.4
> 
>   
> 
>   
> 
> true
> 
>   
> 
>   com.google.auto.value
>   auto-value
>   1.7.4
> 
>   
> 
>   
>
> Cheers,
> Andres
>


Merged configuration between parent & child?

2020-10-15 Thread Andres Almiray
Hello everyone,

I wonder if it's possible to define a plugin's configuration on both parent
& child in such a way that the resulting configuration is merged, first
the  parent's then the child's. My use case is defining a set of annotation
processors in the maven-compiler-plugin at the parent, also adding another
set in the child's maven-compiler-plugin.

The following example is NOT explicitly related to Lombok nor AutoValue,
they are used just as reference. Suggestions to skip Lombok and/or
AutoValue are not needed, thanks.

Given a parent pom such as

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.acme
parent
0.0.0
pom


1.7.4
1.18.14






  org.apache.maven.plugins
  maven-compiler-plugin
  3.8.1
  
  
  
  org.projectlombok
  lombok
  1.18.14
  
  
  






And a child pom as

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.acme
parent
0.0.0


child




  org.apache.maven.plugins
  maven-compiler-plugin
  3.8.1
  true
  
  
  
  com.google.auto.value
  auto-value
  ${auto-value.version}
  
  
  





The desired result when evaluating the child's pom is to have both Lombok
and AutoValue (in that order) in the compiler's configuration. As it
currently stands with Maven 3.6.3 only the child configuration is
available, as shown by running `mvn help:effective-pom`

  
maven-compiler-plugin
3.8.1

  
default-compile
compile

  compile


  

  com.google.auto.value
  auto-value
  1.7.4

  

  
  
default-testCompile
test-compile

  testCompile


  

  com.google.auto.value
  auto-value
  1.7.4

  

  

true

  

  com.google.auto.value
  auto-value
  1.7.4

  

  

Cheers,
Andres