You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rémy Saissy <re...@gmail.com> on 2016/10/21 10:15:18 UTC

Is there a plugin to override classifiers based on groupId?

Hi,
is there a Maven plugin that allows to automatically append a classifier
given a groupId?

I would do something like that:

     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-???-plugin</artifactId>
        <version>x.y</version>
        <executions>
          <execution>
            <configuration>
              <pluginReplacements>
                <pluginReplacement>
                  <matchingPattern>
                    <matchingField>groupId</matchingField>
                    <matchingValue>com.company.dept</matchingValue>
                  </matchingPattern>
                  <replacement>
                    <replacementField>classifier</replacementField>
                    <replacementValue>myclassifier</replacementValue>
                    <overrideIfSet>false</overrideIfSet>
                  </replacement>
                 </pluginReplacements>
              </pluginReplacements>
            </configuration>
          </execution>
        </executions>
      </plugin>




eg. My company has lot projects that should all use a classifier (two
values possible depending on the deployment target).
We could go through all projects over and over again to ensure that they
everybody uses the proper classifiers or put some hard rules in the
deployment code but we would like to find a simple and painless way to
ensure that classifiers are respected. Hence the question.

Thanks!



-- 
Rémy Saissy
Photos: http://picasaweb.google.com/remy.saissy
Blog: http://blog.remysaissy.com

Re: Is there a plugin to override classifiers based on groupId?

Posted by Stephen Connolly <st...@gmail.com>.
Short answer: no

On phone, so can't give long answer

On Friday 21 October 2016, Rémy Saissy <re...@gmail.com> wrote:

> Hi,
> is there a Maven plugin that allows to automatically append a classifier
> given a groupId?
>
> I would do something like that:
>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-???-plugin</artifactId>
>         <version>x.y</version>
>         <executions>
>           <execution>
>             <configuration>
>               <pluginReplacements>
>                 <pluginReplacement>
>                   <matchingPattern>
>                     <matchingField>groupId</matchingField>
>                     <matchingValue>com.company.dept</matchingValue>
>                   </matchingPattern>
>                   <replacement>
>                     <replacementField>classifier</replacementField>
>                     <replacementValue>myclassifier</replacementValue>
>                     <overrideIfSet>false</overrideIfSet>
>                   </replacement>
>                  </pluginReplacements>
>               </pluginReplacements>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>
>
>
>
> eg. My company has lot projects that should all use a classifier (two
> values possible depending on the deployment target).
> We could go through all projects over and over again to ensure that they
> everybody uses the proper classifiers or put some hard rules in the
> deployment code but we would like to find a simple and painless way to
> ensure that classifiers are respected. Hence the question.
>
> Thanks!
>
>
>
> --
> Rémy Saissy
> Photos: http://picasaweb.google.com/remy.saissy
> Blog: http://blog.remysaissy.com
>


-- 
Sent from my phone

Re: Is there a plugin to override classifiers based on groupId?

Posted by Stuart McCulloch <mc...@gmail.com>.
You could write a custom enforcer rule to check the classifier of projects
with particular groupIds:

http://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html

Then configure the enforcer plugin to apply that rule in your corporate pom
or wherever you want to enforce it...

On 22 Oct 2016 00:08, "Rémy Saissy" <re...@gmail.com> wrote:

> Hi,
> is there a Maven plugin that allows to automatically append a classifier
> given a groupId?
>
> I would do something like that:
>
>      <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-???-plugin</artifactId>
>         <version>x.y</version>
>         <executions>
>           <execution>
>             <configuration>
>               <pluginReplacements>
>                 <pluginReplacement>
>                   <matchingPattern>
>                     <matchingField>groupId</matchingField>
>                     <matchingValue>com.company.dept</matchingValue>
>                   </matchingPattern>
>                   <replacement>
>                     <replacementField>classifier</replacementField>
>                     <replacementValue>myclassifier</replacementValue>
>                     <overrideIfSet>false</overrideIfSet>
>                   </replacement>
>                  </pluginReplacements>
>               </pluginReplacements>
>             </configuration>
>           </execution>
>         </executions>
>       </plugin>
>
>
>
>
> eg. My company has lot projects that should all use a classifier (two
> values possible depending on the deployment target).
> We could go through all projects over and over again to ensure that they
> everybody uses the proper classifiers or put some hard rules in the
> deployment code but we would like to find a simple and painless way to
> ensure that classifiers are respected. Hence the question.
>
> Thanks!
>
>
>
> --
> Rémy Saissy
> Photos: http://picasaweb.google.com/remy.saissy
> Blog: http://blog.remysaissy.com
>