maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [maven] adamretter commented on pull request #357: Add wildcard option for direct goal execution id from command line
Date Tue, 02 Jun 2020 10:46:49 GMT

adamretter commented on pull request #357:
URL: https://github.com/apache/maven/pull/357#issuecomment-637454971


   @rfscholte Okay, so this is my use-case...
   
   I am using the [license-maven-plugin](http://mycila.mathieu.photography/license-maven-plugin/)
which allows me to check for and/or format license headers on source-code files. However,
I think my use case is equally applicable for any other plugin.
   
   Our projects's source code uses a couple of different licenses. The license plugin enables
you to configure it for a single license. Therefore, we need one execution of the plugin's
`check` goal per-license that we want to enforce, and we want that bound to the `verify` lifecycle
phase.
   
   Therefore we have a configuration which looks something like this:
   ```xml
   <plugin>
       <groupId>com.mycila</groupId>
       <artifactId>license-maven-plugin</artifactId>
       <version>3.0</version>
   
       <configuration>
           <failIfMissing>false</failIfMissing>
           <strictCheck>true</strictCheck>
           <excludes>
               <exclude>LGPL-21-license.template.txt</exclude>
               <exclude>DBXML-license.template.txt</exclude>
           </excludes>
           <encoding>${project.build.sourceEncoding}</encoding>
       </configuration>
   
       <executions>
   
           <!-- Check that the LGPL 2.1 license is present and correct -->
           <execution>
               <id>check-lgpl-headers</id>
               <phase>verify</phase>
               <goals>
                   <goal>check</goal>
               </goals>
               <configuration>
               	<header>${project.parent.relativePath}/LGPL-21-license.template.txt</header>
               	<excludes>
               		<exclude>src/main/java/org/exist/storage/btree/**</exclude>
               	</excludes>
               </configuration>
           </execution>
   
           <!-- Check that the DBXML license is present and correct (only on BTree files)
-->
           <execution>
               <id>check-dbxml-headers</id>
               <phase>verify</phase>
               <goals>
                   <goal>check</goal>
               </goals>
               <configuration>
               	<header>${project.parent.relativePath}/DBXML-license.template.txt</header>
               	<includes>
               		<include>src/main/java/org/exist/storage/btree/**</exclude>
               	</includes>
               </configuration>
           </execution>
   
       </executions>
   </plugin>
   ```
   
   During development and testing we often want to run `mvn license:check` or even `mvn license:format`
to ensure that our source code has the correct licenses. Unfortunately that only run's for
the *executionId* `default-cli` which equates to  `check-lgpl-headers`, which means that not
all source files are correctly checked for the appropriate license headers.
   
   Now I could indeed run `mvn license:check@check-lgpl-headers && mvn license:check@check-dbxml-headers`.
But that's not very nice... and also there are actually more than two executions involved,
I only showed the two to keep my example short ;-)
   
   Of course, we could just be run `mvn verify`, but we have many other plugins also bound
to that lifecycle, and some of them are very slow and intensive. Also that would only execute
the `check` goals, it doesn't help us with the `format` goals.
   
   With my PR, running `mvn license:check@*` does correctly run each. It in fact creates one
`MojoExecution` per executionId, and for each it merges the parent config with the just the
config for that specific execution, so I don't think we have problems with inheritance. 
   
   Hope that makes sense? Please let me know if I need to do a better job at explaining it...


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message