You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Niall Pemberton <ni...@gmail.com> on 2006/02/14 06:34:02 UTC

[m2] Referencing a plugin configuration attribute in another plugin

I'm trying to reference a plugin configuration attribute in another
plugin's configuration in maven2. Can anyone point me in the right
direction?

Specifically I want to output two config attributes (source & target
JVM) from the "compile" in the jar's manifest file, so I have the
following:

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.3</source>
        <target>1.3</target>
    </configuration>
</plugin>

<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifestEntries>
                <Source-JDK>${maven.compile.source}</Source-JDK>
                <Target-JDK>${maven.compile.target}</Target-JDK>
            </manifestEntries>
        </archive>
    </configuration>
</plugin>

I have used property values ${maven.compile.target} in maven1 - is
there anyway I can reference the source/target configuration values
for "maven-compiler-plugin" in the "maven-jar-plugin" confiuration
items?

Niall

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Referencing a plugin configuration attribute in another plugin

Posted by dan tran <da...@gmail.com>.
Not possible in Maven2.   Plugins dont know each other.

and Yes, maven1 supports this capability ;-)

-Dan

On 2/13/06, Milos Kleint <Mi...@sun.com> wrote:
>
> how about figuring out the default value for some other plugin's
> parameter?
>
> Milos
>
> dan tran wrote:
> > Create a property set
> >
> > <properties>
> >   <source>1.3</source>
> >   <target>1.3</target>
> > </properties>
> >
> > Look up the Pom descriptor to where to place it.
> >
> > Then you can use ${source} and ${target} both plugin configurations
> >
> > -D
> >
> >
> > On 2/13/06, Niall Pemberton <ni...@gmail.com> wrote:
> >
> >> I'm trying to reference a plugin configuration attribute in another
> >> plugin's configuration in maven2. Can anyone point me in the right
> >> direction?
> >>
> >> Specifically I want to output two config attributes (source & target
> >> JVM) from the "compile" in the jar's manifest file, so I have the
> >> following:
> >>
> >> <plugin>
> >>    <artifactId>maven-compiler-plugin</artifactId>
> >>    <configuration>
> >>        <source>1.3</source>
> >>        <target>1.3</target>
> >>    </configuration>
> >> </plugin>
> >>
> >> <plugin>
> >>    <artifactId>maven-jar-plugin</artifactId>
> >>    <configuration>
> >>        <archive>
> >>            <manifestEntries>
> >>                <Source-JDK>${maven.compile.source}</Source-JDK>
> >>                <Target-JDK>${maven.compile.target}</Target-JDK>
> >>            </manifestEntries>
> >>        </archive>
> >>    </configuration>
> >> </plugin>
> >>
> >> I have used property values ${maven.compile.target} in maven1 - is
> >> there anyway I can reference the source/target configuration values
> >> for "maven-compiler-plugin" in the "maven-jar-plugin" confiuration
> >> items?
> >>
> >> Niall
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: [m2] Referencing a plugin configuration attribute in another plugin

Posted by Milos Kleint <Mi...@Sun.COM>.
how about figuring out the default value for some other plugin's parameter?

Milos

dan tran wrote:
> Create a property set
>
> <properties>
>   <source>1.3</source>
>   <target>1.3</target>
> </properties>
>
> Look up the Pom descriptor to where to place it.
>
> Then you can use ${source} and ${target} both plugin configurations
>
> -D
>
>
> On 2/13/06, Niall Pemberton <ni...@gmail.com> wrote:
>   
>> I'm trying to reference a plugin configuration attribute in another
>> plugin's configuration in maven2. Can anyone point me in the right
>> direction?
>>
>> Specifically I want to output two config attributes (source & target
>> JVM) from the "compile" in the jar's manifest file, so I have the
>> following:
>>
>> <plugin>
>>    <artifactId>maven-compiler-plugin</artifactId>
>>    <configuration>
>>        <source>1.3</source>
>>        <target>1.3</target>
>>    </configuration>
>> </plugin>
>>
>> <plugin>
>>    <artifactId>maven-jar-plugin</artifactId>
>>    <configuration>
>>        <archive>
>>            <manifestEntries>
>>                <Source-JDK>${maven.compile.source}</Source-JDK>
>>                <Target-JDK>${maven.compile.target}</Target-JDK>
>>            </manifestEntries>
>>        </archive>
>>    </configuration>
>> </plugin>
>>
>> I have used property values ${maven.compile.target} in maven1 - is
>> there anyway I can reference the source/target configuration values
>> for "maven-compiler-plugin" in the "maven-jar-plugin" confiuration
>> items?
>>
>> Niall
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Referencing a plugin configuration attribute in another plugin

Posted by dan tran <da...@gmail.com>.
In M2 you can define your plugin configuration in the parent/root pom,
but the individual component/child can override as needed.

No idea how you can perform
  "what was being output to the manifest would not be the values the
compiler actually used"

-D

On 2/13/06, Niall Pemberton <ni...@gmail.com> wrote:
>
> Thanks for the suggestion - that worked, although it isn't ideal. I'm
> looking at this with Jakarta Commons in mind, where (possibly) many
> components would inherit from a main pom.xml. Using this approach a
> component could override the "maven-compiler-plugin" configuration and
> then what was being output to the manifest would not be the values the
> compiler actually used. Is there no way of getting a reference to the
> compiler plugin and accesssing its configuration values?
>
> Niall
>
> On 2/14/06, dan tran <da...@gmail.com> wrote:
> > Create a property set
> >
> > <properties>
> >  <source>1.3</source>
> >  <target>1.3</target>
> > </properties>
> >
> > Look up the Pom descriptor to where to place it.
> >
> > Then you can use ${source} and ${target} both plugin configurations
> >
> > -D
> >
> > On 2/13/06, Niall Pemberton <ni...@gmail.com> wrote:
> > >
> > > I'm trying to reference a plugin configuration attribute in another
> > > plugin's configuration in maven2. Can anyone point me in the right
> > > direction?
> > >
> > > Specifically I want to output two config attributes (source & target
> > > JVM) from the "compile" in the jar's manifest file, so I have the
> > > following:
> > >
> > > <plugin>
> > >    <artifactId>maven-compiler-plugin</artifactId>
> > >    <configuration>
> > >        <source>1.3</source>
> > >        <target>1.3</target>
> > >    </configuration>
> > > </plugin>
> > >
> > > <plugin>
> > >    <artifactId>maven-jar-plugin</artifactId>
> > >    <configuration>
> > >        <archive>
> > >            <manifestEntries>
> > >                <Source-JDK>${maven.compile.source}</Source-JDK>
> > >                <Target-JDK>${maven.compile.target}</Target-JDK>
> > >            </manifestEntries>
> > >        </archive>
> > >    </configuration>
> > > </plugin>
> > >
> > > I have used property values ${maven.compile.target} in maven1 - is
> > > there anyway I can reference the source/target configuration values
> > > for "maven-compiler-plugin" in the "maven-jar-plugin" confiuration
> > > items?
> > >
> > > Niall
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: [m2] Referencing a plugin configuration attribute in another plugin

Posted by Niall Pemberton <ni...@gmail.com>.
Thanks for the suggestion - that worked, although it isn't ideal. I'm
looking at this with Jakarta Commons in mind, where (possibly) many
components would inherit from a main pom.xml. Using this approach a
component could override the "maven-compiler-plugin" configuration and
then what was being output to the manifest would not be the values the
compiler actually used. Is there no way of getting a reference to the
compiler plugin and accesssing its configuration values?

Niall

On 2/14/06, dan tran <da...@gmail.com> wrote:
> Create a property set
>
> <properties>
>  <source>1.3</source>
>  <target>1.3</target>
> </properties>
>
> Look up the Pom descriptor to where to place it.
>
> Then you can use ${source} and ${target} both plugin configurations
>
> -D
>
> On 2/13/06, Niall Pemberton <ni...@gmail.com> wrote:
> >
> > I'm trying to reference a plugin configuration attribute in another
> > plugin's configuration in maven2. Can anyone point me in the right
> > direction?
> >
> > Specifically I want to output two config attributes (source & target
> > JVM) from the "compile" in the jar's manifest file, so I have the
> > following:
> >
> > <plugin>
> >    <artifactId>maven-compiler-plugin</artifactId>
> >    <configuration>
> >        <source>1.3</source>
> >        <target>1.3</target>
> >    </configuration>
> > </plugin>
> >
> > <plugin>
> >    <artifactId>maven-jar-plugin</artifactId>
> >    <configuration>
> >        <archive>
> >            <manifestEntries>
> >                <Source-JDK>${maven.compile.source}</Source-JDK>
> >                <Target-JDK>${maven.compile.target}</Target-JDK>
> >            </manifestEntries>
> >        </archive>
> >    </configuration>
> > </plugin>
> >
> > I have used property values ${maven.compile.target} in maven1 - is
> > there anyway I can reference the source/target configuration values
> > for "maven-compiler-plugin" in the "maven-jar-plugin" confiuration
> > items?
> >
> > Niall

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: [m2] Referencing a plugin configuration attribute in another plugin

Posted by dan tran <da...@gmail.com>.
Create a property set

<properties>
  <source>1.3</source>
  <target>1.3</target>
</properties>

Look up the Pom descriptor to where to place it.

Then you can use ${source} and ${target} both plugin configurations

-D


On 2/13/06, Niall Pemberton <ni...@gmail.com> wrote:
>
> I'm trying to reference a plugin configuration attribute in another
> plugin's configuration in maven2. Can anyone point me in the right
> direction?
>
> Specifically I want to output two config attributes (source & target
> JVM) from the "compile" in the jar's manifest file, so I have the
> following:
>
> <plugin>
>    <artifactId>maven-compiler-plugin</artifactId>
>    <configuration>
>        <source>1.3</source>
>        <target>1.3</target>
>    </configuration>
> </plugin>
>
> <plugin>
>    <artifactId>maven-jar-plugin</artifactId>
>    <configuration>
>        <archive>
>            <manifestEntries>
>                <Source-JDK>${maven.compile.source}</Source-JDK>
>                <Target-JDK>${maven.compile.target}</Target-JDK>
>            </manifestEntries>
>        </archive>
>    </configuration>
> </plugin>
>
> I have used property values ${maven.compile.target} in maven1 - is
> there anyway I can reference the source/target configuration values
> for "maven-compiler-plugin" in the "maven-jar-plugin" confiuration
> items?
>
> Niall
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>