You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Olivier Lamy <ol...@apache.org> on 2017/06/09 06:35:11 UTC
packaging type generating the current pom
Hi,
Not sure how to do that in a non hackhish way.
My current goal: generate a bom style pom with all reactor projects in
dptMngt section.
As people are lazy to write dptMngt section in theirs poms they delegate to
others with this pom.
So as I'm lazy too I don't want to write/maintain this pom neither so I
prefer using a plugin for that :-)
So I create a new packaging type bom and enable it on a pom.
The plugin simply generate a pom.xml file with all content and the
calculated dptMngt section.
The only way I found to replace the current pom is to use: project.setFile(
the new pom file)
Any other way?
Cheers
--
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy
Re: packaging type generating the current pom
Posted by Robert Scholte <rf...@apache.org>.
On Fri, 16 Jun 2017 04:55:17 +0200, Olivier Lamy <ol...@apache.org> wrote:
> well not better as it looks not being possible
>
> [ERROR] 'dependencyManagement.dependencies.dependency.classifier' for
> org.eclipse.jetty:jetty-bom:pom:bom must be empty, imported POM cannot
> have
> a classifier. @ line 40, column 21
>
> WHY this restriction?
Only for a bom it could make sense to add a classifier, for all other poms
it doesn't. I can imagine this is historical.
For Maven 5 the proposal is to make a pdt-file for every artifact, but
that won't help you right now.
Robert
>
> On 16 June 2017 at 11:40, Olivier Lamy <ol...@apache.org> wrote:
>
>> Hi Robert
>> Sorry for late reply.
>> Well this doesn't work (see source here [1]) you can attach an artifact
>> with his own GAV.
>> And it's neither possible to change GAV of an attached artifact.
>>
>> Caused by: java.lang.UnsupportedOperationException: Cannot change the
>> groupId for an attached artifact. It is derived from the main
>> artifact.at
>> org.apache.maven.project.artifact.AttachedArtifact.
>> setGroupId(AttachedArtifact.java:110)
>>
>> So at this stage the only solution I have is to attach an artifact with
>> a
>> new classifier "bom"....
>>
>> Cheers
>> Olivier
>>
>> [1] https://github.com/apache/maven/blob/eb6b212b567c287734a2dbbef3c113
>> fe650f1def/maven-core/src/main/java/org/apache/maven/project/
>> DefaultMavenProjectHelper.java#L101
>>
>>
>>
>> On 9 June 2017 at 19:56, Robert Scholte <rf...@apache.org> wrote:
>>
>>> Hi Olivier,
>>>
>>> assuming this bom file is not used by the reactor, it should be
>>> possible
>>> to possible to generate it in the root pom and attach it with its own
>>> GA[1][2].
>>> The javadoc content says this piece of code is deprecated, probably
>>> because it introduces some magic where it is hard to determine where
>>> the
>>> file is coming from. I think we should be able to allow this and in
>>> case of
>>> pom.xml let Maven add some XML comment saying it was provided as part
>>> of
>>> project GA(V)
>>>
>>> Is this less hackish?
>>>
>>> Robert
>>>
>>>
>>> [1] https://maven.apache.org/ref/3.5.0/maven-core/apidocs/org/ap
>>> ache/maven/project/MavenProject.html#addAttachedArtifact(org
>>> .apache.maven.artifact.Artifact)
>>>
>>> [2] https://maven.apache.org/ref/3.5.0/maven-core/apidocs/org/ap
>>> ache/maven/project/DefaultMavenProjectHelper.html#attachArti
>>> fact(org.apache.maven.project.MavenProject,%20org.apache.
>>> maven.artifact.Artifact)
>>>
>>>
>>> On Fri, 09 Jun 2017 08:35:11 +0200, Olivier Lamy <ol...@apache.org>
>>> wrote:
>>>
>>> Hi,
>>>> Not sure how to do that in a non hackhish way.
>>>> My current goal: generate a bom style pom with all reactor projects in
>>>> dptMngt section.
>>>> As people are lazy to write dptMngt section in theirs poms they
>>>> delegate
>>>> to
>>>> others with this pom.
>>>> So as I'm lazy too I don't want to write/maintain this pom neither so
>>>> I
>>>> prefer using a plugin for that :-)
>>>> So I create a new packaging type bom and enable it on a pom.
>>>> The plugin simply generate a pom.xml file with all content and the
>>>> calculated dptMngt section.
>>>> The only way I found to replace the current pom is to use:
>>>> project.setFile(
>>>> the new pom file)
>>>>
>>>> Any other way?
>>>>
>>>> Cheers
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>>
>>
>>
>> --
>> Olivier Lamy
>> http://twitter.com/olamy | http://linkedin.com/in/olamy
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: packaging type generating the current pom
Posted by Olivier Lamy <ol...@apache.org>.
well not better as it looks not being possible
[ERROR] 'dependencyManagement.dependencies.dependency.classifier' for
org.eclipse.jetty:jetty-bom:pom:bom must be empty, imported POM cannot have
a classifier. @ line 40, column 21
WHY this restriction?
On 16 June 2017 at 11:40, Olivier Lamy <ol...@apache.org> wrote:
> Hi Robert
> Sorry for late reply.
> Well this doesn't work (see source here [1]) you can attach an artifact
> with his own GAV.
> And it's neither possible to change GAV of an attached artifact.
>
> Caused by: java.lang.UnsupportedOperationException: Cannot change the
> groupId for an attached artifact. It is derived from the main artifact.at
> org.apache.maven.project.artifact.AttachedArtifact.
> setGroupId(AttachedArtifact.java:110)
>
> So at this stage the only solution I have is to attach an artifact with a
> new classifier "bom"....
>
> Cheers
> Olivier
>
> [1] https://github.com/apache/maven/blob/eb6b212b567c287734a2dbbef3c113
> fe650f1def/maven-core/src/main/java/org/apache/maven/project/
> DefaultMavenProjectHelper.java#L101
>
>
>
> On 9 June 2017 at 19:56, Robert Scholte <rf...@apache.org> wrote:
>
>> Hi Olivier,
>>
>> assuming this bom file is not used by the reactor, it should be possible
>> to possible to generate it in the root pom and attach it with its own
>> GA[1][2].
>> The javadoc content says this piece of code is deprecated, probably
>> because it introduces some magic where it is hard to determine where the
>> file is coming from. I think we should be able to allow this and in case of
>> pom.xml let Maven add some XML comment saying it was provided as part of
>> project GA(V)
>>
>> Is this less hackish?
>>
>> Robert
>>
>>
>> [1] https://maven.apache.org/ref/3.5.0/maven-core/apidocs/org/ap
>> ache/maven/project/MavenProject.html#addAttachedArtifact(org
>> .apache.maven.artifact.Artifact)
>>
>> [2] https://maven.apache.org/ref/3.5.0/maven-core/apidocs/org/ap
>> ache/maven/project/DefaultMavenProjectHelper.html#attachArti
>> fact(org.apache.maven.project.MavenProject,%20org.apache.
>> maven.artifact.Artifact)
>>
>>
>> On Fri, 09 Jun 2017 08:35:11 +0200, Olivier Lamy <ol...@apache.org>
>> wrote:
>>
>> Hi,
>>> Not sure how to do that in a non hackhish way.
>>> My current goal: generate a bom style pom with all reactor projects in
>>> dptMngt section.
>>> As people are lazy to write dptMngt section in theirs poms they delegate
>>> to
>>> others with this pom.
>>> So as I'm lazy too I don't want to write/maintain this pom neither so I
>>> prefer using a plugin for that :-)
>>> So I create a new packaging type bom and enable it on a pom.
>>> The plugin simply generate a pom.xml file with all content and the
>>> calculated dptMngt section.
>>> The only way I found to replace the current pom is to use:
>>> project.setFile(
>>> the new pom file)
>>>
>>> Any other way?
>>>
>>> Cheers
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>
>
> --
> Olivier Lamy
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
--
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy
Re: packaging type generating the current pom
Posted by Olivier Lamy <ol...@apache.org>.
Hi Robert
Sorry for late reply.
Well this doesn't work (see source here [1]) you can attach an artifact
with his own GAV.
And it's neither possible to change GAV of an attached artifact.
Caused by: java.lang.UnsupportedOperationException: Cannot change the
groupId for an attached artifact. It is derived from the main artifact.at
org.apache.maven.project.artifact.AttachedArtifact.setGroupId(AttachedArtifact.java:110)
So at this stage the only solution I have is to attach an artifact with a
new classifier "bom"....
Cheers
Olivier
[1]
https://github.com/apache/maven/blob/eb6b212b567c287734a2dbbef3c113fe650f1def/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java#L101
On 9 June 2017 at 19:56, Robert Scholte <rf...@apache.org> wrote:
> Hi Olivier,
>
> assuming this bom file is not used by the reactor, it should be possible
> to possible to generate it in the root pom and attach it with its own
> GA[1][2].
> The javadoc content says this piece of code is deprecated, probably
> because it introduces some magic where it is hard to determine where the
> file is coming from. I think we should be able to allow this and in case of
> pom.xml let Maven add some XML comment saying it was provided as part of
> project GA(V)
>
> Is this less hackish?
>
> Robert
>
>
> [1] https://maven.apache.org/ref/3.5.0/maven-core/apidocs/org/ap
> ache/maven/project/MavenProject.html#addAttachedArtifact(
> org.apache.maven.artifact.Artifact)
>
> [2] https://maven.apache.org/ref/3.5.0/maven-core/apidocs/org/ap
> ache/maven/project/DefaultMavenProjectHelper.html#
> attachArtifact(org.apache.maven.project.MavenProject,%
> 20org.apache.maven.artifact.Artifact)
>
>
> On Fri, 09 Jun 2017 08:35:11 +0200, Olivier Lamy <ol...@apache.org> wrote:
>
> Hi,
>> Not sure how to do that in a non hackhish way.
>> My current goal: generate a bom style pom with all reactor projects in
>> dptMngt section.
>> As people are lazy to write dptMngt section in theirs poms they delegate
>> to
>> others with this pom.
>> So as I'm lazy too I don't want to write/maintain this pom neither so I
>> prefer using a plugin for that :-)
>> So I create a new packaging type bom and enable it on a pom.
>> The plugin simply generate a pom.xml file with all content and the
>> calculated dptMngt section.
>> The only way I found to replace the current pom is to use:
>> project.setFile(
>> the new pom file)
>>
>> Any other way?
>>
>> Cheers
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
--
Olivier Lamy
http://twitter.com/olamy | http://linkedin.com/in/olamy
Re: packaging type generating the current pom
Posted by Robert Scholte <rf...@apache.org>.
Hi Olivier,
assuming this bom file is not used by the reactor, it should be possible
to possible to generate it in the root pom and attach it with its own
GA[1][2].
The javadoc content says this piece of code is deprecated, probably
because it introduces some magic where it is hard to determine where the
file is coming from. I think we should be able to allow this and in case
of pom.xml let Maven add some XML comment saying it was provided as part
of project GA(V)
Is this less hackish?
Robert
[1]
https://maven.apache.org/ref/3.5.0/maven-core/apidocs/org/apache/maven/project/MavenProject.html#addAttachedArtifact(org.apache.maven.artifact.Artifact)
[2]
https://maven.apache.org/ref/3.5.0/maven-core/apidocs/org/apache/maven/project/DefaultMavenProjectHelper.html#attachArtifact(org.apache.maven.project.MavenProject,%20org.apache.maven.artifact.Artifact)
On Fri, 09 Jun 2017 08:35:11 +0200, Olivier Lamy <ol...@apache.org> wrote:
> Hi,
> Not sure how to do that in a non hackhish way.
> My current goal: generate a bom style pom with all reactor projects in
> dptMngt section.
> As people are lazy to write dptMngt section in theirs poms they delegate
> to
> others with this pom.
> So as I'm lazy too I don't want to write/maintain this pom neither so I
> prefer using a plugin for that :-)
> So I create a new packaging type bom and enable it on a pom.
> The plugin simply generate a pom.xml file with all content and the
> calculated dptMngt section.
> The only way I found to replace the current pom is to use:
> project.setFile(
> the new pom file)
>
> Any other way?
>
> Cheers
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org