override Checkstyle resources config

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

override Checkstyle resources config

Javier Gómez
Hello all,

We are trying to run Checkstyle plugin over a group of resource files, located in various directories outside standard directory layout, in project root folder,

/module1
   src/main/java
   src/main/resources
   pom.xml
/module2
   ...
/src
/DIR1
/DIR2
pom.xml

To do this, the best way we found, was configure execution of checkstyle plugin in parent POM,
and set this directories as resources in checkstyle plugin <configuration>

       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-checkstyle-plugin</artifactId>
         <inherited>false</inherited>
         <configuration>
           <resources>
             <resource>
               <directory>dir1</directory>
             </resource>
             <resource>
               <directory>dir2</directory>
             </resource>
           </resources>
         </configuration>
       </plugin>


I know that the *resources* attribute is defined *readonly*, but this configuration works, and the resources in this directories are analyzed.
Is there any possible side effect with this ?
The modules in project inherits a checkstyle configuration from parent *pluginManagement* that is not affected by this hack.


Regards


Javier

Reply | Threaded
Open this post in threaded view
|

Re: override Checkstyle resources config

Javier Gómez
Any thoughts on this?

We don't want to define this spefic folders config in POM build
<resources> block,  to avoid inherit that in child POMs.
But we want that they were analyzed by checkstyle plugin, so we are
forcing that  at the plugin level, specifying the <resources> block.

That this is a read-only attribute, and we define it in the plugin
configuration, does not imply that the compilation fails, as I would
expect. Is this correct?

Thanks in advance.

Javier


On 2020/04/20 18:34:23, Javier Gómez wrote:
 > Hello all,>
 >
 > We are trying to run Checkstyle plugin over a group of resource
files, located in various directories outside standard directory layout,
in project root folder,>
 >
 > /module1>
 > src/main/java>
 > src/main/resources>
 > pom.xml>
 > /module2>
 > ...>
 > /src>
 > /DIR1>
 > /DIR2>
 > pom.xml>
 >
 > To do this, the best way we found, was configure execution of
checkstyle plugin in parent POM,>
 > and set this directories as resources in checkstyle plugin >
 >
 > >
 > org.apache.maven.plugins>
 > maven-checkstyle-plugin>
 > false>
 > >
 > >
 > >
 > dir1>
 > >
 > >
 > dir2>
 > >
 > >
 > >
 > >
 >
 >
 > I know that the *resources* attribute is defined *readonly*, but this
configuration works, and the resources in this directories are analyzed.>
 > Is there any possible side effect with this ?>
 > The modules in project inherits a checkstyle configuration from
parent *pluginManagement* that is not affected by this hack.>
 >
 >
 > Regards>
 >
 >
 > Javier>
 >
 >
--


               
Javier Gómez Rodríguez
Gerente y fundador
*+34.615270595* • [hidden email] <mailto:[hidden email]>

Prefapp Cloud Consulting S.L.
Edificio CEM - Cidade da Cultura de Galicia
Monte Gaias s/n - 15707 Santiago de Compostela
[hidden email] <mailto:[hidden email]> • https://prefapp.es 
<http://https://prefapp.es>
------------------------------------------------------------------------

La información contenida en este mensaje y los archivos adjuntos es
confidencial, cualquier modificación, retransmisión, difusión u otro uso
de esta información por personas o entidades distintas a las personas a
las que va dirigida está prohibida salvo que esté autorizado
expresamente por el emisor del mensaje. Si recibe este mensaje por
error, por favor borre el mensaje de cualquier ordenador sin copiarlo ni
comunicarlo e informe al emisor del mismo. Aunque PREFAPP CLOUD
CONSULTING S.L. ha adoptado las precauciones necesarias, recomendamos
adopte las medidas oportunas para comprobar que no existen, en este
mensaje, elementos que puedan afectar a su equipo informático. PREFAPP
CLOUD CONSULTING S.L. no aceptará ninguna responsabilidad acerca de los
daños o pérdidas que pudieran producirse por este motivo. Asimismo, le
informamos que las manifestaciones contenidas en el mensaje son
responsabilidad exclusiva y personal de quien lo envía.
Reply | Threaded
Open this post in threaded view
|

Re: override Checkstyle resources config

Hervé BOUTEMY
for reference, useful discussion on dev@maven of:
- plugins read-only parameters, per plugin conception,
- Maven 3.x bug that allows configuring such supposed read-only parameter (was properly forbidden in Maven 2)
- this Maven core bug will be fixed in future Maven 3.7.0
- then some builds using the bug will break, and people will have to work with plugin developers to eventually add new features around the read-only parameter if it was a missing feature

see detailed discussion in https://lists.apache.org/thread.html/rf16612451ece2b2fcdd678d06cc6dad9b687f5d9cfba11ae66b12137%40%3Cdev.maven.apache.org%3E

Regards,

Hervé

Le jeudi 23 avril 2020, 19:44:08 CEST Javier Gómez a écrit :

> Any thoughts on this?
>
> We don't want to define this spefic folders config in POM build
> <resources> block,  to avoid inherit that in child POMs.
> But we want that they were analyzed by checkstyle plugin, so we are
> forcing that  at the plugin level, specifying the <resources> block.
>
> That this is a read-only attribute, and we define it in the plugin
> configuration, does not imply that the compilation fails, as I would
> expect. Is this correct?
>
> Thanks in advance.
>
> Javier
>
> On 2020/04/20 18:34:23, Javier Gómez wrote:
>  > Hello all,>
>  >
>  > We are trying to run Checkstyle plugin over a group of resource
>
> files, located in various directories outside standard directory layout,
> in project root folder,>
>
>  > /module1>
>  > src/main/java>
>  > src/main/resources>
>  > pom.xml>
>  > /module2>
>  > ...>
>  > /src>
>  > /DIR1>
>  > /DIR2>
>  > pom.xml>
>  >
>  > To do this, the best way we found, was configure execution of
>
> checkstyle plugin in parent POM,>
>
>  > and set this directories as resources in checkstyle plugin >
>  >
>  >
>  > org.apache.maven.plugins>
>  > maven-checkstyle-plugin>
>  > false>
>  >
>  >
>  >
>  > dir1>
>  >
>  >
>  > dir2>
>  >
>  >
>  >
>  >
>  >
>  >
>  > I know that the *resources* attribute is defined *readonly*, but this
>
> configuration works, and the resources in this directories are analyzed.>
>
>  > Is there any possible side effect with this ?>
>  > The modules in project inherits a checkstyle configuration from
>
> parent *pluginManagement* that is not affected by this hack.>
>
>  > Regards>
>  >
>  >
>  > Javier>





---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]