Comments (9)
So you want the parent to check its own dir and all children to inherit a configuration to check (the same dir for everyone)?
I would use the <pluginManagement>
section on the parent to specify the configuration for all child modules and then have the parent itself override it with its own conf in its own plugin definition.
Or maybe you just did that and it didn't work?
I'll try to come up with an example to see if something doesn't work as expected: if you can provide excerpts of what you have in the parent and in your child modules for configuring the plugin, it would help.
from shellcheck-maven-plugin.
Hi @marco-nicolini,
Thanks for your investigation. That is exactly what I am trying to achieve.
My feature request would be to have a simple skip option, which one can use to avoid execution in a module which does not contain any shell script.
What do you think?
from shellcheck-maven-plugin.
I found nothing wrong in the plugin itself, but I think I understand what your problem is now.
- You need to configure the plugin in the parent (to have it check /project/scripts/*.sh)
- You can override the plugin conf you had in the parent for a specific module (moduleA) that has file to check (moduleA/src/main/resources/*.sh)
- You cannot stop the plugin to execute for moduleB and moduleC, because you have it configured in the parent (due to 1).
I think the maven way to do that is what I did in this integration test here
Brief explanation:
- there is a parent pom and 3 children.
- parent wants to check files in one directory of its own
- child-module-one doesn't want to execute the plugin
- child-module-two and child-module-three want to check files in each own src/main/resources
In parent pom:
<build>
<pluginManagement>
<plugins>
<!-- configuration for every module -->
<plugin>
<groupId>dev.dimlight</groupId>
<artifactId>shellcheck-maven-plugin</artifactId>
<version>0.3.2</version>
<executions>
<execution>
<id>simple-check</id>
<!-- Every one that wants to execute will have to specify its phase -->
<phase>none</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>**/*.sh</include>
</includes>
</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>dev.dimlight</groupId>
<artifactId>shellcheck-maven-plugin</artifactId>
<!--
this disables inheritance of this plugin definition for child modules!
they will have to define the plugin on their own if they need it
-->
<inherited>false</inherited>
<executions>
<execution>
<id>simple-check</id>
<phase>verify</phase><!-- overrides the plugin management phase none -->
<configuration>
<sourceDirs>
<sourceDir>
<directory>${project.basedir}/parent-module-scripts</directory>
<includes>
<include>**/*.sh</include>
</includes>
</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
In child-module-two and child-module-three pom:
<plugins>
<plugin>
<groupId>dev.dimlight</groupId>
<artifactId>shellcheck-maven-plugin</artifactId>
<executions>
<execution>
<id>simple-check</id>
<phase>verify</phase><!-- override the inherited plugin management phase none -->
</execution>
</executions>
</plugin>
</plugins>
child-module one pom, has nothing regarding the shellcheck plugin.
The above works and it's maven-only, not requiring changes to the plugin.
Please give feedback if it's ok or not :)
Still I think that there are 2 things that the plugin could have to help in these situations:
- We can have an explicit skip flag, which is generally useful.
- We can have an option to skip the shellcheck invocation if no files to check are found: this however comes withe the risks to hide misconfigurations (I'm thinking I am checking some files
but I don't and I won't get errors that there is nothing to check...) so (if I implement it) I will leave it disabled by default.
from shellcheck-maven-plugin.
Whatever... i cannot for the life of me format correctly my reply above...
from shellcheck-maven-plugin.
Thanks a lot @marco-nicolini ,
I wasn't aware of this inherit possibility. I will try it out :)
from shellcheck-maven-plugin.
Note that to make it work you also need to have:
- the
<phase>none</phase>
in the shared configuration (in parent's pluginManagement) - the
<phase>verify</phase>
(or whatever other phase you want) in the parent and every child that wants to execute it. (This is in fact the override of the none set in the pluginManagement section)
I will add the skip option (which is simpler than fiddling with phases/executions and maven inheritance).
from shellcheck-maven-plugin.
I just released version 0.4.0 with the skip flag. It will take some time (hours usually) to be synced to maven central.
from shellcheck-maven-plugin.
Hi @marco-nicolini,
I can confirm skip option in version 0.4.0 is working as expected. This issue can be closed.
Thanks again
from shellcheck-maven-plugin.
Thanks to you, glad to be of help.
from shellcheck-maven-plugin.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shellcheck-maven-plugin.