format openapi/swagger generated java source using maven plugin - maven

I've openapi plugin to autogenerate some java source code using mustache files as template.
I wish to format this code using google java style. I followed example at this link:
https://shankulk.com/format-your-java-code-with-google-java-format-5bf4de8756f5
This works but it formats the entire source code at src/main/java and src/main/test
I wish to format only generated code which is in target/
I tried using path as highlighted but it still formats the entire source code including auto generated code in target/
is there other standard maven plugin that can be used for this purpose or how can i set this up?

Related

Avoid sonarqube analysis of source code automatically generated

my project generates at runtime source code from thrift file. Is there a way to avoid Sonarqube analyzes this source code automatically generated? This because I have some code smell and bug detected by Sonarqube in that generated code I can't modify and correct.
Yes. Excluding the source files or any other files from sonar analysis is possible, by using sonar.exclusions property in your sonar.properties
For example, if your source file generated is xyz.java in some folder say target, so you can exclude the file, like this
sonar.exclusions=**/target/*.java
or you can give the file name directly
sonar.exclusions=**/target/xyz.java
You can find more details here: https://docs.sonarqube.org/latest/project-administration/narrowing-the-focus/

Generating PDF from AsciiDoc using Maven and place it in a different module

I am using Maven and have multiple modules in my project. One module of my project is "documentation". There I made some AsciiDoc and in the pom file of the "documentation" module I put something to build the PDF and HTML of my AsciiDoc (I am using AsciiDoctor). For example for the PDF's output file I use this:
<outputFile>${project.build.directory}\generated-docs\MyDocument.pdf</outputFile>
This is working fine. Now I want to place this PDF into a different module "distribution", which is also a module of my project, and is at the same level as "documentation". I was thinking of adding some dependency in my "distribution" to my "documentation" module to be able then to put the PDF in a subfolder "documents" of "distribution". However, I don't know how I can do this, because I don't know how to access something from a different module in the pom of "distribution". Or is there another/better way to do this?
Any help would be appreciated.
I ended up achieving my goal by using a file "translate.xml" that specifies the generated pdf and specifies as an output the distribution folder in a FileSet. Then in my pom I use maven-assembly-plugin to take this translate.xml file and place my pdf in a zip in the distribution folder.

How to package a Vaadin Add-On created by Maven archetype "vaadin-archetype-widget" version 8.1.x?

I have successfully implemented some ColumnRenderer classes for adapting java.time types for display with Vaadin Grid. See source code here if curious.
Now I would like to publish these as an Add-On in the Vaadin Directory. I read these directions in the Vaadin guide, but they seem incomplete and outdated.
There is discussion of exporting from Eclipse which is not relevant to me (using IntelliJ) and is probably old-school now that Vaadin team has moved to thorough support of Maven.
The "Manifest" is mentioned but not documented with no mention of file name nor file location. No documentation on format or individual values.
I found a manifest file MANIFEST.MF in my Maven-created project, but it is in a format of key+colon+value while the manifest shown in that documentation seems to be XML format. Which format is currently correct?
My found MANIFEST.MF file contains variable names such as ${Vaadin-Addon} and ${Vaadin-License-Title} and ${Implementation-Version}. Where are these defined?

Is there a independent maven artifact used as a docbook generate tools

Actually there is a maven plugin docbkx-maven-plugin which can generate pdf, html or other format in the maven project, but the problem is you need to configure more about xsl template, css, or if you want to highlight the source code, support other language like Chinese, you also need to do more configures, so Is there a independent maven artifact used as a docbook generate tools, includes following features:
include the dtd files
code highlight support
non-english support, means can generate pdf like in Chinese content
have a default xsl template for generate html, pdf

how to make checkstyle ignore xml files in my application

i've configured my checkstyle plugin with customized checkstyle.xml and it works fine with the java classes but having a lot of warnings with the xml files can anyone suggest how to disable the check style from any xml file in my application.
thanks in advance.
I can think of two ways to do that:
You could suppress findings from non-Java files. This works very well inside and outside of your IDE.
If you are using Eclipse, you can also configure Eclipse not to feed the non-Java files to Checkstyle. In order to do that, right-click your project and click Checkstyle. Uncheck use simple configuration. Specify a file set using \.java$ as regexp. You will see the list of files in the bottom half of the dialog window change to only Java files.
In earlier versions of Checkstyle, I think I remember that there also was a file name filter in the configuration XML, but I can't seem to find it in the docs now, so maybe that feature is no more.
There is a basedir property at the start of the Checker module in the check style config file. Uncomment it if it is commented.
Set it's value to the folder you want to apply your checkstyle rules to.
E.g. src folder of any eclipse project only contains java files.
<!-- If you set the basedir property below, then all reported file names
will be relative to the specified directory. See http://checkstyle.sourceforge.net/5.x/config.html#Checker -->
<property name="basedir" value="/MyEclipeProject/src"/>

Resources