Example maven parent

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Example maven parent

brunobat

Hi folks,

In my examples I've never declared the parent in the pom.xml like in here:

<parent>
    <artifactId>examples</artifactId>
    <groupId>org.apache.tomee</groupId>
    <version>8.0.0-SNAPSHOT</version>
</parent>

This is because I wanted to precisely control the dependencies on the project.

I was reviewing a PR from José Ventura and I noticed that even if he was using the right dependencies, the created WAR was way too big. I traced the issue to the the parent pom of TomEE. We include unneeded dependencies in all examples... See attached image with bundled libs.

In this example, for the websocket-tls-basic-auth example, it doesn't declare a parent pom and it generates a WAR file with 5.5KB.

Adding a Parent definition boosts the WAR size to 7.3MB.

Additionally, the build goes from 9.18s to 13,89s. This has the potential of saving a lot of space and build time.

Test outcome is the same.

I'd say we have a problem here. What do you guys think we should do?

  1. Remove Parent definition on examples and fix the ones that will break.
  2. Use Parent always and fix the dependencies scope.
  3. A mix of both. Use parent when needed and fix the dependencies scope.

Thoughts?

Cheers.

Reply | Threaded
Open this post in threaded view
|

Re: Example maven parent

David Blevins-2
> On Dec 5, 2018, at 10:28 AM, Bruno Baptista <[hidden email]> wrote:
>
> I'd say we have a problem here. What do you guys think we should do?
>
> • Remove Parent definition on examples and fix the ones that will break.
> • Use Parent always and fix the dependencies scope.
> • A mix of both. Use parent when needed and fix the dependencies scope.

Historically we've not used parents because the goal of each example is to be completely independent in every way from the other examples and the TomEE build overall.  The intention is people can grab an example and build on it in their own projects without having to perform surgery to "cut it free" from the parent pom.

This conversation typically comes up because people are trying to remove duplication between the examples, which is good habit normally and therefore most people's initial gut reaction.

When you're on the learning side, however, it significantly increases the complexity of the example because:

 - basic "project" structure is moved to the example parent, which then has complexity of removing duplication between 139 examples
 - some of that complexity will then move to the top-level tomee parent pom to reduce duplication further
 - inevitably someone will say "maybe MicroProfile examples should have their own parent pom"

The result is then if a user would want to make their own tiny project based on a MicroProfile example they would need to spend a few hours learning how to untangle this theoretical pom inheritance chain:

 - tomee/examples/microprofile/metrics-counted/pom.xml
 - tomee/examples/microprofile/pom.xml
 - tomee/examples/pom.xml
 - tomee/pom.xml

As coders we'll be thrilled by how much duplication we removed.  As someone learning, you basically have to be an expert in maven and our build structure and be extremely willing to invest time in trial and error to recreate your own truly independent example you can then build from.

For certain things like Arquillian, the pom is the hardest part, so if it isn't completely self contained and independent, it is pretty much an unusable example.

At least that's how the conversation has historically gone.  We can certainly have it again and maybe create some documentation to help example authors understand the goals/motivations.


-David




Reply | Threaded
Open this post in threaded view
|

Re: Example maven parent

brunobat
Thanks for the context David.

I'll write a PR with README at the Examples project level with some
guidelines that we can discuss. There were some other resources to help
make new examples. Will research that too.

Cheers

Bruno Baptista
https://twitter.com/brunobat_


On 05/12/18 21:21, David Blevins wrote:

>> On Dec 5, 2018, at 10:28 AM, Bruno Baptista <[hidden email]> wrote:
>>
>> I'd say we have a problem here. What do you guys think we should do?
>>
>> • Remove Parent definition on examples and fix the ones that will break.
>> • Use Parent always and fix the dependencies scope.
>> • A mix of both. Use parent when needed and fix the dependencies scope.
> Historically we've not used parents because the goal of each example is to be completely independent in every way from the other examples and the TomEE build overall.  The intention is people can grab an example and build on it in their own projects without having to perform surgery to "cut it free" from the parent pom.
>
> This conversation typically comes up because people are trying to remove duplication between the examples, which is good habit normally and therefore most people's initial gut reaction.
>
> When you're on the learning side, however, it significantly increases the complexity of the example because:
>
>   - basic "project" structure is moved to the example parent, which then has complexity of removing duplication between 139 examples
>   - some of that complexity will then move to the top-level tomee parent pom to reduce duplication further
>   - inevitably someone will say "maybe MicroProfile examples should have their own parent pom"
>
> The result is then if a user would want to make their own tiny project based on a MicroProfile example they would need to spend a few hours learning how to untangle this theoretical pom inheritance chain:
>
>   - tomee/examples/microprofile/metrics-counted/pom.xml
>   - tomee/examples/microprofile/pom.xml
>   - tomee/examples/pom.xml
>   - tomee/pom.xml
>
> As coders we'll be thrilled by how much duplication we removed.  As someone learning, you basically have to be an expert in maven and our build structure and be extremely willing to invest time in trial and error to recreate your own truly independent example you can then build from.
>
> For certain things like Arquillian, the pom is the hardest part, so if it isn't completely self contained and independent, it is pretty much an unusable example.
>
> At least that's how the conversation has historically gone.  We can certainly have it again and maybe create some documentation to help example authors understand the goals/motivations.
>
>
> -David
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Example maven parent

brunobat
Hi folks,

I've created a jira and a PR to define the rules/guidelines in the
creation of new examples.

Jira: https://issues.apache.org/jira/browse/TOMEE-2326

PR: https://github.com/apache/tomee/pull/257

Please feel free to comment and ask for changes.

Cheers.

Bruno Baptista
https://twitter.com/brunobat_


On 05/12/18 22:23, Bruno Baptista wrote:

> Thanks for the context David.
>
> I'll write a PR with README at the Examples project level with some
> guidelines that we can discuss. There were some other resources to
> help make new examples. Will research that too.
>
> Cheers
>
> Bruno Baptista
> https://twitter.com/brunobat_
>
>
> On 05/12/18 21:21, David Blevins wrote:
>>> On Dec 5, 2018, at 10:28 AM, Bruno Baptista <[hidden email]> wrote:
>>>
>>> I'd say we have a problem here. What do you guys think we should do?
>>>
>>>     • Remove Parent definition on examples and fix the ones that
>>> will break.
>>>     • Use Parent always and fix the dependencies scope.
>>>     • A mix of both. Use parent when needed and fix the dependencies
>>> scope.
>> Historically we've not used parents because the goal of each example
>> is to be completely independent in every way from the other examples
>> and the TomEE build overall.  The intention is people can grab an
>> example and build on it in their own projects without having to
>> perform surgery to "cut it free" from the parent pom.
>>
>> This conversation typically comes up because people are trying to
>> remove duplication between the examples, which is good habit normally
>> and therefore most people's initial gut reaction.
>>
>> When you're on the learning side, however, it significantly increases
>> the complexity of the example because:
>>
>>   - basic "project" structure is moved to the example parent, which
>> then has complexity of removing duplication between 139 examples
>>   - some of that complexity will then move to the top-level tomee
>> parent pom to reduce duplication further
>>   - inevitably someone will say "maybe MicroProfile examples should
>> have their own parent pom"
>>
>> The result is then if a user would want to make their own tiny
>> project based on a MicroProfile example they would need to spend a
>> few hours learning how to untangle this theoretical pom inheritance
>> chain:
>>
>>   - tomee/examples/microprofile/metrics-counted/pom.xml
>>   - tomee/examples/microprofile/pom.xml
>>   - tomee/examples/pom.xml
>>   - tomee/pom.xml
>>
>> As coders we'll be thrilled by how much duplication we removed. As
>> someone learning, you basically have to be an expert in maven and our
>> build structure and be extremely willing to invest time in trial and
>> error to recreate your own truly independent example you can then
>> build from.
>>
>> For certain things like Arquillian, the pom is the hardest part, so
>> if it isn't completely self contained and independent, it is pretty
>> much an unusable example.
>>
>> At least that's how the conversation has historically gone.  We can
>> certainly have it again and maybe create some documentation to help
>> example authors understand the goals/motivations.
>>
>>
>> -David
>>
>>
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Example maven parent

Jean-Louis MONTEIRO
Thanks Bruno. I'll review it very quick

--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com


On Thu, Dec 6, 2018 at 2:44 PM Bruno Baptista <[hidden email]> wrote:

> Hi folks,
>
> I've created a jira and a PR to define the rules/guidelines in the
> creation of new examples.
>
> Jira: https://issues.apache.org/jira/browse/TOMEE-2326
>
> PR: https://github.com/apache/tomee/pull/257
>
> Please feel free to comment and ask for changes.
>
> Cheers.
>
> Bruno Baptista
> https://twitter.com/brunobat_
>
>
> On 05/12/18 22:23, Bruno Baptista wrote:
> > Thanks for the context David.
> >
> > I'll write a PR with README at the Examples project level with some
> > guidelines that we can discuss. There were some other resources to
> > help make new examples. Will research that too.
> >
> > Cheers
> >
> > Bruno Baptista
> > https://twitter.com/brunobat_
> >
> >
> > On 05/12/18 21:21, David Blevins wrote:
> >>> On Dec 5, 2018, at 10:28 AM, Bruno Baptista <[hidden email]>
> wrote:
> >>>
> >>> I'd say we have a problem here. What do you guys think we should do?
> >>>
> >>>     • Remove Parent definition on examples and fix the ones that
> >>> will break.
> >>>     • Use Parent always and fix the dependencies scope.
> >>>     • A mix of both. Use parent when needed and fix the dependencies
> >>> scope.
> >> Historically we've not used parents because the goal of each example
> >> is to be completely independent in every way from the other examples
> >> and the TomEE build overall.  The intention is people can grab an
> >> example and build on it in their own projects without having to
> >> perform surgery to "cut it free" from the parent pom.
> >>
> >> This conversation typically comes up because people are trying to
> >> remove duplication between the examples, which is good habit normally
> >> and therefore most people's initial gut reaction.
> >>
> >> When you're on the learning side, however, it significantly increases
> >> the complexity of the example because:
> >>
> >>   - basic "project" structure is moved to the example parent, which
> >> then has complexity of removing duplication between 139 examples
> >>   - some of that complexity will then move to the top-level tomee
> >> parent pom to reduce duplication further
> >>   - inevitably someone will say "maybe MicroProfile examples should
> >> have their own parent pom"
> >>
> >> The result is then if a user would want to make their own tiny
> >> project based on a MicroProfile example they would need to spend a
> >> few hours learning how to untangle this theoretical pom inheritance
> >> chain:
> >>
> >>   - tomee/examples/microprofile/metrics-counted/pom.xml
> >>   - tomee/examples/microprofile/pom.xml
> >>   - tomee/examples/pom.xml
> >>   - tomee/pom.xml
> >>
> >> As coders we'll be thrilled by how much duplication we removed. As
> >> someone learning, you basically have to be an expert in maven and our
> >> build structure and be extremely willing to invest time in trial and
> >> error to recreate your own truly independent example you can then
> >> build from.
> >>
> >> For certain things like Arquillian, the pom is the hardest part, so
> >> if it isn't completely self contained and independent, it is pretty
> >> much an unusable example.
> >>
> >> At least that's how the conversation has historically gone.  We can
> >> certainly have it again and maybe create some documentation to help
> >> example authors understand the goals/motivations.
> >>
> >>
> >> -David
> >>
> >>
> >>
> >>
>
   --
    Jean-Louis Monteiro
    http://twitter.com/jlouismonteiro
    http://www.tomitribe.com
Reply | Threaded
Open this post in threaded view
|

Re: Example maven parent

Jean-Louis MONTEIRO
There are some typos in there. See review
--
Jean-Louis Monteiro
http://twitter.com/jlouismonteiro
http://www.tomitribe.com


On Thu, Dec 6, 2018 at 3:43 PM Jean-Louis Monteiro <[hidden email]>
wrote:

> Thanks Bruno. I'll review it very quick
>
> --
> Jean-Louis Monteiro
> http://twitter.com/jlouismonteiro
> http://www.tomitribe.com
>
>
> On Thu, Dec 6, 2018 at 2:44 PM Bruno Baptista <[hidden email]> wrote:
>
>> Hi folks,
>>
>> I've created a jira and a PR to define the rules/guidelines in the
>> creation of new examples.
>>
>> Jira: https://issues.apache.org/jira/browse/TOMEE-2326
>>
>> PR: https://github.com/apache/tomee/pull/257
>>
>> Please feel free to comment and ask for changes.
>>
>> Cheers.
>>
>> Bruno Baptista
>> https://twitter.com/brunobat_
>>
>>
>> On 05/12/18 22:23, Bruno Baptista wrote:
>> > Thanks for the context David.
>> >
>> > I'll write a PR with README at the Examples project level with some
>> > guidelines that we can discuss. There were some other resources to
>> > help make new examples. Will research that too.
>> >
>> > Cheers
>> >
>> > Bruno Baptista
>> > https://twitter.com/brunobat_
>> >
>> >
>> > On 05/12/18 21:21, David Blevins wrote:
>> >>> On Dec 5, 2018, at 10:28 AM, Bruno Baptista <[hidden email]>
>> wrote:
>> >>>
>> >>> I'd say we have a problem here. What do you guys think we should do?
>> >>>
>> >>>     • Remove Parent definition on examples and fix the ones that
>> >>> will break.
>> >>>     • Use Parent always and fix the dependencies scope.
>> >>>     • A mix of both. Use parent when needed and fix the dependencies
>> >>> scope.
>> >> Historically we've not used parents because the goal of each example
>> >> is to be completely independent in every way from the other examples
>> >> and the TomEE build overall.  The intention is people can grab an
>> >> example and build on it in their own projects without having to
>> >> perform surgery to "cut it free" from the parent pom.
>> >>
>> >> This conversation typically comes up because people are trying to
>> >> remove duplication between the examples, which is good habit normally
>> >> and therefore most people's initial gut reaction.
>> >>
>> >> When you're on the learning side, however, it significantly increases
>> >> the complexity of the example because:
>> >>
>> >>   - basic "project" structure is moved to the example parent, which
>> >> then has complexity of removing duplication between 139 examples
>> >>   - some of that complexity will then move to the top-level tomee
>> >> parent pom to reduce duplication further
>> >>   - inevitably someone will say "maybe MicroProfile examples should
>> >> have their own parent pom"
>> >>
>> >> The result is then if a user would want to make their own tiny
>> >> project based on a MicroProfile example they would need to spend a
>> >> few hours learning how to untangle this theoretical pom inheritance
>> >> chain:
>> >>
>> >>   - tomee/examples/microprofile/metrics-counted/pom.xml
>> >>   - tomee/examples/microprofile/pom.xml
>> >>   - tomee/examples/pom.xml
>> >>   - tomee/pom.xml
>> >>
>> >> As coders we'll be thrilled by how much duplication we removed. As
>> >> someone learning, you basically have to be an expert in maven and our
>> >> build structure and be extremely willing to invest time in trial and
>> >> error to recreate your own truly independent example you can then
>> >> build from.
>> >>
>> >> For certain things like Arquillian, the pom is the hardest part, so
>> >> if it isn't completely self contained and independent, it is pretty
>> >> much an unusable example.
>> >>
>> >> At least that's how the conversation has historically gone.  We can
>> >> certainly have it again and maybe create some documentation to help
>> >> example authors understand the goals/motivations.
>> >>
>> >>
>> >> -David
>> >>
>> >>
>> >>
>> >>
>>
>
   --
    Jean-Louis Monteiro
    http://twitter.com/jlouismonteiro
    http://www.tomitribe.com
Reply | Threaded
Open this post in threaded view
|

Re: Example maven parent

brunobat
Thanks Jean-Louis.

Fixed

Bruno Baptista
https://twitter.com/brunobat_


On 06/12/18 14:46, Jean-Louis Monteiro wrote:

> There are some typos in there. See review
> --
> Jean-Louis Monteiro
> http://twitter.com/jlouismonteiro
> http://www.tomitribe.com
>
>
> On Thu, Dec 6, 2018 at 3:43 PM Jean-Louis Monteiro <[hidden email]>
> wrote:
>
>> Thanks Bruno. I'll review it very quick
>>
>> --
>> Jean-Louis Monteiro
>> http://twitter.com/jlouismonteiro
>> http://www.tomitribe.com
>>
>>
>> On Thu, Dec 6, 2018 at 2:44 PM Bruno Baptista <[hidden email]> wrote:
>>
>>> Hi folks,
>>>
>>> I've created a jira and a PR to define the rules/guidelines in the
>>> creation of new examples.
>>>
>>> Jira: https://issues.apache.org/jira/browse/TOMEE-2326
>>>
>>> PR: https://github.com/apache/tomee/pull/257
>>>
>>> Please feel free to comment and ask for changes.
>>>
>>> Cheers.
>>>
>>> Bruno Baptista
>>> https://twitter.com/brunobat_
>>>
>>>
>>> On 05/12/18 22:23, Bruno Baptista wrote:
>>>> Thanks for the context David.
>>>>
>>>> I'll write a PR with README at the Examples project level with some
>>>> guidelines that we can discuss. There were some other resources to
>>>> help make new examples. Will research that too.
>>>>
>>>> Cheers
>>>>
>>>> Bruno Baptista
>>>> https://twitter.com/brunobat_
>>>>
>>>>
>>>> On 05/12/18 21:21, David Blevins wrote:
>>>>>> On Dec 5, 2018, at 10:28 AM, Bruno Baptista <[hidden email]>
>>> wrote:
>>>>>> I'd say we have a problem here. What do you guys think we should do?
>>>>>>
>>>>>>      • Remove Parent definition on examples and fix the ones that
>>>>>> will break.
>>>>>>      • Use Parent always and fix the dependencies scope.
>>>>>>      • A mix of both. Use parent when needed and fix the dependencies
>>>>>> scope.
>>>>> Historically we've not used parents because the goal of each example
>>>>> is to be completely independent in every way from the other examples
>>>>> and the TomEE build overall.  The intention is people can grab an
>>>>> example and build on it in their own projects without having to
>>>>> perform surgery to "cut it free" from the parent pom.
>>>>>
>>>>> This conversation typically comes up because people are trying to
>>>>> remove duplication between the examples, which is good habit normally
>>>>> and therefore most people's initial gut reaction.
>>>>>
>>>>> When you're on the learning side, however, it significantly increases
>>>>> the complexity of the example because:
>>>>>
>>>>>    - basic "project" structure is moved to the example parent, which
>>>>> then has complexity of removing duplication between 139 examples
>>>>>    - some of that complexity will then move to the top-level tomee
>>>>> parent pom to reduce duplication further
>>>>>    - inevitably someone will say "maybe MicroProfile examples should
>>>>> have their own parent pom"
>>>>>
>>>>> The result is then if a user would want to make their own tiny
>>>>> project based on a MicroProfile example they would need to spend a
>>>>> few hours learning how to untangle this theoretical pom inheritance
>>>>> chain:
>>>>>
>>>>>    - tomee/examples/microprofile/metrics-counted/pom.xml
>>>>>    - tomee/examples/microprofile/pom.xml
>>>>>    - tomee/examples/pom.xml
>>>>>    - tomee/pom.xml
>>>>>
>>>>> As coders we'll be thrilled by how much duplication we removed. As
>>>>> someone learning, you basically have to be an expert in maven and our
>>>>> build structure and be extremely willing to invest time in trial and
>>>>> error to recreate your own truly independent example you can then
>>>>> build from.
>>>>>
>>>>> For certain things like Arquillian, the pom is the hardest part, so
>>>>> if it isn't completely self contained and independent, it is pretty
>>>>> much an unusable example.
>>>>>
>>>>> At least that's how the conversation has historically gone.  We can
>>>>> certainly have it again and maybe create some documentation to help
>>>>> example authors understand the goals/motivations.
>>>>>
>>>>>
>>>>> -David
>>>>>
>>>>>
>>>>>
>>>>>