Open Miishri opened 1 year ago
Would it be better to use the plugin provided by Intellij?
I think you should configure the plugin ( add it to the pom.xml) and run it as a goal :
<goals>
<goal>format</goal>
</goals>
then you can execute the command mvn fmt:format
here is an example on how to implement it:
<properties>
<fmt-maven-plugin.version>last version here</fmt-maven-plugin.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.coveo</groupId>
<artifactId>fmt-maven-plugin</artifactId>
<version>${fmt-maven-plugin.version}</version>
<executions>
<execution>
<id>google-format</id>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<configurations>
<alias>format</alias>
</configurations>
Would it be possible to have alias instead of using the full groupId to run format command?
The fmt-maven-plugin does not directly support configuring an alias for its goals. The
I have used the format and it works on validation for mvn validate. Please check it as I cannot find the pom.xml and unsure where to test in the task branch I have created.
After doing some digging, I have sound the old pom.xml that you were using. Should I copy that and use it in my branch just for the sake of testing? Is there any other way you want me to through with this?
https://github.com/SirOphis/jscheduler/commit/fee622ac1c4786c1608154c4f46f30ec543f3cbe?short_path=e0cd712#diff-e0cd71223ea366733ef4996911891caf5f2b1668a138df8661b557fcc5069bb1
Could I also use maven-invoker-plugin to create automated tests instead of manual testing?
Hello, create a separated issue for maven-invoker-plugin. also i will add a new pom.xml and a project structure in the main branch you just have to rebase it on top of your branch then test and commit everything.
Hey,
I saw your recent commit for the project and I am confused about the files. Why is there a mvn wrapper inside the back folder as well as the jscheduler folder?
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.jscheduler:jscheduler >----------------------
[INFO] Building jscheduler 0.0.1-SNAPSHOT
[INFO] from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- fmt:2.21.1:format (google-java-format) @ jscheduler ---
[INFO] Skipping format check: project uses 'pom' packaging
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.736 s
[INFO] Finished at: 2023-11-20T08:58:48+01:00
[INFO] ------------------------------------------------------------------------
[WARNING]
[WARNING] Plugin validation issues were detected in 1 plugin(s)
[WARNING]
[WARNING] * com.spotify.fmt:fmt-maven-plugin:2.21.1
[WARNING]
[WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE]
[WARNING]
I have tried running the plugin and it causes these issues? Could I get any insights on how to ensure it doesn't skip the format check due to pom packaging?
Hello, "I saw your recent commit for the project and I am confused about the files. Why is there a mvn wrapper inside the back folder as well as the jscheduler folder?" -> we are implementing a modular approach for each microservice, we have a parent folder "back" that has a general pom.xml packaged as pom that will server for common dependencies between all modules such as "lombok" "spring boot starter" etc and each module has his own pom.xml that inherit all of those common dependencies etc.
-> to apply the google formatter plugin to all submodules, you can configure it in the
I'm confused regarding which one is the parent pom? If it's the one in Jscheduler folder then why does it have relative path? Isn't that only to link children pom xmls to inherit from? Please correct me if I'm wrong, I'll continue by adding the parent pom path to the child pom xmls relative paths.
regarding your question:
Parent POM (jscheduler/pom.xml):
This POM should have
example :
<project>
<!-- specifying the packaging pom so it is a parent for our submodules -->
<packaging>pom</packaging>
<!-- Add Spring Boot parent -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
</parent>
<!-- Other configurations and dependencies as needed -->
<modules>
<module>submodule</module>
<!-- Add other modules as needed -->
</modules>
</project>
In our submodules (forexample : usermodule) the pom should have a parent section for example:
<parent>
<groupId>com.jscheduler</groupId>
<artifactId>jscheduler</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <!--we should specify the path to our parent pom-->
</parent>
and the artifactId with the name of the submodule that will be also precised in the parent pom.xml in
<artifactId>submodule</artifactId>
about the relative path in our parent pom.xml we can omit it i hope it is clear now !
The Google Java Format is the default format for the project. I will be adding the spotify format plugin that uses google java format under the hood to format.
Maven dependency
Use case for pom.xml
Required run case
mvn validate