Re: Inject xml into the POM for build specific elements.

2017-06-05 Thread George Kopf
Thanks!  We're using Maven 3.  I just haven't refactored the pom yet.

On Mon, Jun 5, 2017 at 8:47 AM, Karl Heinz Marbaise 
wrote:

> Hi George,
>
> based on the comments in your example...
>
> Are you really using Maven 2 ? Please remove it...cause it's long end of
> life...
>
>
> Furthermore the repositories should be defined in users settings.xml and
> not inside the pom file...The distributionManagement should be done in a
> corporate pom only once...
>
> Kind regards
> Karl Heinz Marbaise
>
>
> On 05/06/17 14:42, George Kopf wrote:
>
>> Thank you for your help.  I figured it out using the tiles-maven-plugin.
>>
>> After fighting through the documentation I put together a simple tile and
>> pulled it into my pom.
>>
>> To clarify what the docs are saying:
>>
>> 1.  The tile will be called tile.xml, will be installed in your maven
>> repository along with a pom.xml that has uses the tiles-maven-plugin.
>> 2.  The project pom also uses the tiles-maven-plugin but it has the
>> configuration element to reference your tile.
>>
>>
>> Here is a concrete example of a tile for the jacoco plugin and then
>> inject the tile into your project pom.
>>
>> tile.xml
>> 
>> 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";>
>> 
>>  
>>  
>>  org.jacoco
>>  jacoco-maven-plugin
>>  0.7.9
>>  
>>  
>>  default-prepare-agent
>>  
>>  prepare-agent
>>  
>>  
>>  
>>  default-report
>>  prepare-package
>>  
>>  report
>>  
>>  
>>  
>>  default-check
>>  
>>  check
>>  
>>  
>>  
>>  
>>  
>>  BUNDLE
>>  
>>  
>>  
>>  COMPLEXITY
>>  COVEREDRATIO
>>  0.0
>>  
>>  
>>  
>>  
>>  
>>  
>>  
>>  
>> 
>> 
>> 
>>
>>
>>
>>
>> pom.xml that accompanies the tile.xml in your maven repository
>>
>> 
>> 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
>>
>>  edu.school
>>  cdp_build_tile
>>  1.0-SNAPSHOT
>>  tile
>>
>>  
>>  
>>  snapshots
>>  Nexus Repository
>>  default
>>  http://server.school.edu:8081/nexus/content/reposit
>> ories/snapshots
>>  
>>  
>>
>>  
>>  
>>  nexus
>>  Nexus Repository
>>  default
>>  http://server.school.edu:8081/nexus
>>  
>>  true
>>  
>>  
>>  
>>  
>>  
>>  
>>  io.repaint.maven
>>  tiles-maven-plugin
>>  2.10
>>  true
>>  
>>  
>>  
>> 
>>
>>
>> build section of your project's pom
>>  
>>  
>>  
>>  io.repaint.maven
>>  tiles-maven-plugin
>>  2.10
>>  true
>>  
>>  false
>>  
>>  edu.school:cdp_build_ti
>> le:1.0-SNAPSHOT
>>  
>>  
>>

Re: Inject xml into the POM for build specific elements.

2017-06-05 Thread George Kopf
Thank you for your help.  I figured it out using the tiles-maven-plugin.

After fighting through the documentation I put together a simple tile and
pulled it into my pom.

To clarify what the docs are saying:

1.  The tile will be called tile.xml, will be installed in your maven
repository along with a pom.xml that has uses the tiles-maven-plugin.
2.  The project pom also uses the tiles-maven-plugin but it has the
configuration element to reference your tile.


Here is a concrete example of a tile for the jacoco plugin and then inject
the tile into your project pom.

tile.xml

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";>



org.jacoco
jacoco-maven-plugin
0.7.9


default-prepare-agent

prepare-agent



default-report
prepare-package

report



default-check

check





BUNDLE



COMPLEXITY
COVEREDRATIO
0.0















pom.xml that accompanies the tile.xml in your maven repository


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

edu.school
cdp_build_tile
1.0-SNAPSHOT
tile



snapshots
Nexus Repository
default

http://server.school.edu:8081/nexus/content/repositories/snapshots





nexus
Nexus Repository
default
http://server.school.edu:8081/nexus

true






io.repaint.maven
tiles-maven-plugin
2.10
true






build section of your project's pom



io.repaint.maven
tiles-maven-plugin
2.10
true

false

edu.school:cdp_build_tile:1.0-SNAPSHOT










On Tue, May 30, 2017 at 1:25 PM, Karl Heinz Marbaise 
wrote:

> Hi,
>
> On 30/05/17 16:44, George Kopf wrote:
>
>> I apologize if this topic has already been discussed.  I searched all over
>> the web and the archives and didn't find anything, but I can't believe
>> that
>> I'm the only person with this request.
>>
>
> No need to apologize for asking...
>
>
>> I'm running the CI/CD pipeline for several java projects.
>>
>> We're using Git, Maven, Jenkins, Sonar, and Nexus.
>>
>> I would like to to have the developers create and own their own POM.XML
>> that will be used for Snapshots and Release Candidates.
>>
>
> and in consequence also for releases ?
>
>
>> I want to add my build specific POM elements to the effective POM for the
>> CI process but I don't want their POM to have to include all the extra
>> elements for Jacoco and Sonar (and whatever else we add in the future >
>> I can do this with profiles but then their POM will have everything in it.
>> I can do this with a parent POM but they already have a parent POM
>> (springboot) so that they can run locally.
>>
>
> If you have springboot as parent it might be a good choice to use spring
> as bom instead of as a parent...than you can control things different and
> better...
>
> Does it not work ?
>
> So where is the difference for a CI pom and usual pom file ?
>
> >
> I would have to insert my
>
>> parent pom in between and that seems fragile since mine is only for CI
>> builds.
>>
>
> What exactly is fragile here?
>
>
>
>> I can't do this with the settings.xml, on the build server, because it
>> doesn't have all the required elements.
>>

Inject xml into the POM for build specific elements.

2017-05-30 Thread George Kopf
I apologize if this topic has already been discussed.  I searched all over
the web and the archives and didn't find anything, but I can't believe that
I'm the only person with this request.

I'm running the CI/CD pipeline for several java projects.

We're using Git, Maven, Jenkins, Sonar, and Nexus.

I would like to to have the developers create and own their own POM.XML
that will be used for Snapshots and Release Candidates.

I want to add my build specific POM elements to the effective POM for the
CI process but I don't want their POM to have to include all the extra
elements for Jacoco and Sonar (and whatever else we add in the future).

I can do this with profiles but then their POM will have everything in it.
I can do this with a parent POM but they already have a parent POM
(springboot) so that they can run locally.  I would have to insert my
parent pom in between and that seems fragile since mine is only for CI
builds.

I can't do this with the settings.xml, on the build server, because it
doesn't have all the required elements.

I hope that there is something obvious that I've missed (like a Jenkins
plugin) but I'm about to give up and just require the developers to live
with an excessively complicated POM file.

Thanks.

-- 
George Kopf