Giter Site home page Giter Site logo

prettier-maven-plugin's Introduction

prettier-maven-plugin

Maven plugin for running prettier-java during a build. Node, prettier, and prettier-java are downloaded automatically as needed.

There is a check goal which (optionally) fails the build if code isn't formatted correctly, and a write goal which rewrites the source code in place. A common setup might be to use the write goal during local builds, and the check goal during CI builds.

Example Usage

This example will run the check goal inside of Travis CI, and the write goal outside of Travis CI. You can update the profile activation conditions based on the CI tool you use.

<properties>
  <!-- By default just re-write code with prettier -->
  <plugin.prettier.goal>write</plugin.prettier.goal>
</properties>

<build>
  <plugins>
    <plugin>
      <groupId>com.hubspot.maven.plugins</groupId>
      <artifactId>prettier-maven-plugin</artifactId>
      <version>0.16</version>
      <configuration>
        <prettierJavaVersion>2.0.0</prettierJavaVersion>
        <printWidth>90</printWidth>
        <tabWidth>2</tabWidth>
        <useTabs>false</useTabs>
        <ignoreConfigFile>true</ignoreConfigFile>
        <ignoreEditorConfig>true</ignoreEditorConfig>
        <!-- Use <inputGlobs> to override the default input patterns -->
        <inputGlobs>
          <!-- These are the default patterns, you can omit <inputGlobs> entirely unless you want to override them -->
          <inputGlob>src/main/java/**/*.java</inputGlob>
          <inputGlob>src/test/java/**/*.java</inputGlob>
        </inputGlobs>
      </configuration>
      <executions>
        <execution>
          <phase>validate</phase>
          <goals>
            <goal>${plugin.prettier.goal}</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

<profiles>
  <profile>
    <id>travis</id>
    <activation>
      <property>
        <name>env.TRAVIS</name>
      </property>
    </activation>
    <properties>
      <!-- But in our CI environment we want to validate that code is formatted -->
      <plugin.prettier.goal>check</plugin.prettier.goal>
    </properties>
  </profile>
</profiles>

You can also run in a one-off fashion via the commandline:
mvn prettier:check
or
mvn prettier:write

You can also run mvn prettier:print-args in order to confirm the configuration values

To format additional directories or file types via the commandline, you can pass a comma-separated list of patterns, for example:
mvn prettier:write '-Dprettier.inputGlobs=src/main/java/**/*.java,src/test/java/**/*.java,src/main/js/**/*.js'

Configuration

If you want to customize the behavior of prettier, you can use a normal prettier configuration file. Alternatively, you can configure prettier directly via the Maven plugin using the following options:

Name -D property name Default Value Description
skip N/A false If set to true, plugin execution will be skipped
fail N/A true Only appplies to check goal. If set to true, the plugin execution will fail if any unformatted files are found
generateDiff N/A false Only appplies to check goal. Be sure to have to sh and diff in your PATH. If set to true, a diff will be generated between the current code and the prettier-formatted code.
diffGenerator prettier.diffGenerator _ Only appplies to check goal. Can be used to supply a custom implementation of DiffGenerator
nodeVersion prettier.nodeVersion 16.13.1 Controls version of Node used to run prettier-java.
nodePath prettier.nodePath - Can be used to supply your own node executable, rather than having the plugin download it. To use the version of node on your $PATH, you can simply set this option to node.
npmPath prettier.npmPath - Can be used to supply your own npm executable, rather than having the plugin download it. To use the version of npm on your $PATH, you can simply set this option to npm.
prettierJavaVersion prettier.prettierJavaVersion 0.7.0 Controls version of prettier-java that is used.
printWidth prettier.printWidth null If set, will be passed to prettier as --print-width. More information here
tabWidth prettier.tabWidth null If set, will be passed to prettier as --tab-width. More information here
useTabs prettier.useTabs null If set, will be passed to prettier as --use-tabs. More information here
endOfLine prettier.endOfLine null If set, will be passed to prettier as --end-of-line. More information here
ignoreConfigFile prettier.ignoreConfigFile false If set to true, pretter will be invoked with --no-config. More information here
ignoreEditorConfig prettier.ignoreEditorConfig false If set to true, pretter will be invoked with --no-editorconfig. More information here
inputGlobs prettier.inputGlobs src/{main,test}/java/**/*.java Controls the input paths passed to prettier, useful for formatting additional directories or file types. More information here
disableGenericsLinebreaks prettier.disableGenericsLinebreaks false Prevents prettier from adding linebreaks to generic type declarations (see #78 for more background)

Generic Linebreaks

The disableGenericsLinebreaks option is implemented by patching prettier-plugin-java after downloading. As new versions of prettier-java are released, we may need to create updated patches. The basic flow for creating a new patch is:

  1. Download the new version of prettier-java
  • cd /tmp && npm install prettier-plugin-java@{version}
  1. Make two copies of prettier-java code
  • mkdir -p a/node_modules && cp -r node_modules/prettier-plugin-java a/node_modules)
  • mkdir -p b/node_modules && cp -r node_modules/prettier-plugin-java b/node_modules)
  1. Update the code within b/node_modules/prettier-plugin-java/dist/ as needed to revert the generic linebreak behavior (for now, these are the relevant PRs: #512, #584)
  2. Generate a diff between a/ (original code) and b/ (updated code)
  • git diff -p a b --no-prefix > no-linebreak-generics-{version}.patch
  1. Add the patch to src/main/resources/ and update the logic in PrettierArgs.java to use it as appropriate

Note

For convenience, this plugin downloads Node, prettier, and prettier-java as needed. Node is downloaded from https://nodejs.org/dist/ and prettier-plugin-java is downloaded via npm

prettier-maven-plugin's People

Contributors

clementdessoude avatar deftdawg avatar dependabot[bot] avatar hs-jenkins-bot avatar jaredstehler avatar jhaber avatar jtkiesel avatar kmclarnon avatar morganwu277 avatar msaguer avatar phlppnhllngr avatar sanjayrawat1 avatar spitfjre avatar stevie400 avatar suruuk avatar trushev avatar warrenseine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prettier-maven-plugin's Issues

Prettier-Java 0.8.0

It would be awesome, if prettier-java 0.8.0 could also be supported in order to use prettier 2.x.

Way to format this on save

Just curious if there's a way of formatting this on save? I am using intelliJ.
I have tried to use the file-watcher plugin, with the following config for my IDE:

Screenshot 2024-06-20 at 15 11 19

When I save my file I get the following error:

//.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.16/prettier-maven-plugin-0.16-prettier-java-0.7.0/prettier-java/node_modules/prettier/bin-prettier.js --write src/main/java/MyFile.java
[error] No matching files. Patterns tried: src/main/javaMyFile.java !**/node_modules/** !./node_modules/** !**/.{git,svn,hg}/** !./.{git,svn,hg}/**

Process finished with exit code 2

Here's the output of print-args:

printWidth=90
tabWidth=4
useTabs=false
noConfig=true
noEditorconfig=true
inputGlob=src/main/java/**/*.java
inputGlob=src/test/java/**/*.java
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.273 s
[INFO] Finished at: 2024-06-20T15:15:03+01:00
[INFO] ------------------------------------------------------------------------

Process finished with exit code 0

And if I manually trigger prettier:write that is also fine. Ideally this would be something that runs on every save, so I don't have to think about it!

Any idea or help would be appreciated!

Plugin hangs forever (0.18, javaPrettierVersion 0.8.3 and above)

Hi!

I'm running into an issue where I'm upgrading to a new Java version (from 11 to 17), in which text blocks get introduced in my codebase. Without additional configuration, the maven plugin appears to use java-prettier 0.7.0, which does not support this newer java version yet. This was added in java-prettier 1.0.0. When setting the prettierJavaVersion configuration setting for the maven plugin, it seems any version above 0.8.2 hangs forever. A snippet from the maven debug output:

❯ mvn prettier:check -X                                                                                                                                                                                                                                                                                              ─╯
Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
Maven home: /usr/local/Cellar/maven/3.8.7/libexec
Java version: 15.0.2, vendor: Amazon.com Inc., runtime: /Users/gjaltems/Library/Java/JavaVirtualMachines/corretto-15.0.2/Contents/Home
Default locale: en_NL, platform encoding: US-ASCII
OS name: "mac os x", version: "13.1", arch: "x86_64", family: "mac"
...
[DEBUG] Goal:          com.hubspot.maven.plugins:prettier-maven-plugin:0.18:check (default-cli)
[DEBUG] Style:         Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <diffGeneratorType default-value="com.hubspot.maven.plugins.prettier.diff.DefaultDiffGenerator">${prettier.diffGenerator}</diffGeneratorType>
  <endOfLine>auto</endOfLine>
  <extractPrettierToTargetDirectory default-value="false"/>
  <fail default-value="true"/>
  <generateDiff default-value="false"/>
  <ignoreConfigFile default-value="false">true</ignoreConfigFile>
  <ignoreEditorConfig default-value="false">true</ignoreEditorConfig>
  <inputGlobs>${prettier.inputGlobs}</inputGlobs>
  <localRepository default-value="${settings.localRepository}"/>
  <nodePath default-value="">${prettier.nodePath}</nodePath>
  <nodeVersion default-value="16.13.2">${prettier.nodeVersion}</nodeVersion>
  <npmPath default-value="">${prettier.npmPath}</npmPath>
  <prettierJavaVersion default-value="0.7.0">1.0.2</prettierJavaVersion>
  <printWidth>100</printWidth>
  <project default-value="${project}"/>
  <skip default-value="false">false</skip>
  <tabWidth>2</tabWidth>
  <useTabs>false</useTabs>
  <pluginDescriptor default-value="${plugin}"/>
</configuration>
[INFO] --- prettier-maven-plugin:0.18:check (default-cli) @ project-restapi ---
[DEBUG] Determined os: MAC_X64
[DEBUG] Reusing cached node at: /Users/gjaltems/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.18/node-v16.13.2-darwin-x64
[DEBUG] Reusing cached prettier-java at: /Users/gjaltems/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.18/prettier-java-1.0.2
[DEBUG] Running prettier with args: /Users/gjaltems/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.18/node-v16.13.2-darwin-x64/bin/node /Users/gjaltems/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.18/prettier-java-1.0.2/node_modules/prettier/bin-prettier.js --plugin=/Users/gjaltems/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.18/prettier-java-1.0.2/node_modules/prettier-plugin-java --color --print-width 100 --tab-width 2 --use-tabs false --end-of-line auto --no-config --no-editorconfig --check src/main/java/**/*.java src/test/java/**/*.java

Running the last command manually works just fine - it spits out a bunch of files that need formatting.
I have tried using Java 15 instead of 17 (which was used for the logs above, as well), I have tried using pretter-maven-plugin versions 0.13, 0.17 and 0.18, and every java-prettier version between 0.7.0 and 1.0.0. I have also tried cleaning the maven caches.

Am I doing something wrong, or have I found a bug? Any help would be greatly appreciated!

Update default value for nodeVersion

Running prettier-maven-plugin on GitHub Actions, I get this warning:

Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions-js/push@master. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.

(You can also see it here.)

I see in the readme that currently the default value for nodeVersion is 16.13.1. I've updated it in my project to 21.7.2, and that runs just fine.

Is it possible to update the default value for nodeVersion?

Downloading from nodejs.org is blocked by firewall

When I updated to version 0.18, the maven build broke with this error message:

[ERROR] Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.18:write (default) on <project-name>: Error downloading node: Connection reset -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.18:write (default) on project <project-name>: Error downloading node

I think this is caused by the firewall on the build machine blocking attempted download of nodejs from https://nodejs.org

Option to fail build after it has checked all modules

Thanks for the great plugin!

I've a multi-module project with about 10 modules. The build currently produces warnings and fails with the first failing module. Thus, I need to fix the issues, then re-run the build, fix, rinse and repeat 10 times until I've covered all 10 modules.

Is it possible to make the build continue but fail at the end? perhaps through a config option like <failFast>true/false<failFast>?

I'd be happy to work on a PR if there are no objections to this.

Code formatting issues found, please run prettier-java

Hello guys, when I try to run mvn install in a Spring Boot starter project with the following config:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>realmeet</artifactId>
        <groupId>br.com.mrj</groupId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>realmeet-service</artifactId>
    <properties>
        <java.version>11</java.version>
        <testcontainers.version>1.15.2</testcontainers.version>
        <mapstruct.version>1.4.2.Final</mapstruct.version>
        <jackson-databind-nullable.version>0.2.1</jackson-databind-nullable.version>
        <springdoc-openapi-ui.version>1.5.4</springdoc-openapi-ui.version>
        <mockito-junit-jupiter.version>3.7.7</mockito-junit-jupiter.version>
        <prettier-maven-plugin.version>0.10</prettier-maven-plugin.version>
    </properties>
    <dependencies>
        <!--  Data  -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <!--  MapStruct  -->
        <dependency>
            <groupId>org.mapstruct</groupId>
            <artifactId>mapstruct</artifactId>
            <version>${mapstruct.version}</version>
        </dependency>
        <!--  Documentation  -->
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>${springdoc-openapi-ui.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openapitools</groupId>
            <artifactId>jackson-databind-nullable</artifactId>
            <version>${jackson-databind-nullable.version}</version>
        </dependency>
        <dependency>
            <groupId>io.swagger</groupId>
            <artifactId>swagger-annotations</artifactId>
            <version>${swagger-annotations.version}</version>
        </dependency>
        <!--  Test  -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>mysql</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>${mockito-junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>br.com.mrj</groupId>
            <artifactId>realmeet-client</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.testcontainers</groupId>
                <artifactId>testcontainers-bom</artifactId>
                <version>${testcontainers.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <resources>
            <resource>
                <directory>target/generated-sources/openapi/src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
            <resource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.4.5</version>
                <configuration>
                    <mainClass>br.com.mrj.realmeet.Application</mainClass>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <annotationProcessorPaths>
                        <path>
                            <groupId>org.mapstruct</groupId>
                            <artifactId>mapstruct-processor</artifactId>
                            <version>${mapstruct.version}</version>
                        </path>
                    </annotationProcessorPaths>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.hubspot.maven.plugins</groupId>
                <artifactId>prettier-maven-plugin</artifactId>
                <version>0.14</version>
                <configuration>
                    <prettierJavaVersion>1.3.0</prettierJavaVersion>
                    <printWidth>90</printWidth>
                    <tabWidth>2</tabWidth>
                    <useTabs>false</useTabs>
                    <ignoreConfigFile>true</ignoreConfigFile>
                    <ignoreEditorConfig>true</ignoreEditorConfig>
                    <!-- Use <inputGlobs> to override the default input patterns -->
                    <inputGlobs>
                        <!-- These are the default patterns, you can omit <inputGlobs> entirely unless you want to override them -->
                        <inputGlob>src/main/java/**/*.java</inputGlob>
                        <inputGlob>src/test/java/**/*.java</inputGlob>
                    </inputGlobs>
                </configuration>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>versions-maven-plugin</artifactId>
                <version>${versions-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>display-property-updates</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>${openapi-generator-maven-plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${openapi-spec.file}</inputSpec>
                            <generatorName>spring</generatorName>
                            <modelPackage>${api.path}.api.model</modelPackage>
                            <apiPackage>${api.path}.api.facade</apiPackage>
                            <configOptions>
                                <interfaceOnly>true</interfaceOnly>
                                <dateLibrary>java8</dateLibrary>
                                <java8>true</java8>
                                <async>true</async>
                                <serializableModel>true</serializableModel>
                                <configPackage>${api.path}.api.config</configPackage>
                                <classpathTargetSpec>${openapi-spec.classpath}</classpathTargetSpec>
                                <isCorsEnabled>true</isCorsEnabled>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

It returns following error:
Screenshot from 2021-09-04 00-22-31

I tried to search about this error but I couldn't find anything to solve...

Running on ARM

I'm running under Docker on macOS on an M1 chip. By default, Docker Desktop runs Linux on linux/arm64/v8, which is pretty cool.

However, the Node executable bundled with prettier-maven-plugin is built for x86_64 and fails with:

root@host:/var/code# /root/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.17/prettier-maven-plugin-0.17-node-12.13.0-linux.exe
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory

When I explicit ask Docker to run with platform linux/amd64, it works, so there's a workaround. However, I'd be much better to have a compatible Node for this architecture.

I wonder if #64 would help here?

Illegal char <:> at index 4: node:internal/modules/cjs/loader:936

Not sure if this is an issue for this repo or for jhipster/prettier-java. I just tried setting up this plugin in our project, and all my attempts to run it yield this error message:

Illegal char <:> at index 4: node:internal/modules/cjs/loader:936

I took the config from your readme, removed what I didn't need, and tried updating the versions too. I also noticed using the implicit default inputGlobs yields paths with mixed forward and backward slashes (windows) in print-args, specifying the inputGlobs as per the readme makes them consistent. I thought the backslashes might be causing the syntax error, but apparently that's not it.

image

[INFO] --- prettier-maven-plugin:0.18:print-args (default-cli) @ dfrecall ---
nodeExecutable=C:\Users\leaumar.m2\repository\com\hubspot\maven\plugins\prettier-maven-plugin\0.18\node-v16.13.2-win-x64\node.exe
npmCommand=C:\Users\leaumar.m2\repository\com\hubspot\maven\plugins\prettier-maven-plugin\0.18\node-v16.13.2-win-x64\node.exe C:\Users\leaumar.m2\repository\com\hubspot\maven\plugins\prettier-maven-plugin\0.18\node-v16.13.2-win-x64\node_modules\npm\bin\npm-cli.js
prettierBin=C:\Users\leaumar.m2\repository\com\hubspot\maven\plugins\prettier-maven-plugin\0.18\prettier-java-1.6.2\node_modules\prettier\bin-prettier.js
prettierJavaPlugin=C:\Users\leaumar.m2\repository\com\hubspot\maven\plugins\prettier-maven-plugin\0.18\prettier-java-1.6.2\node_modules\prettier-plugin-java
printWidth=120
inputGlob=src\main\java//*.java
inputGlob=src\test\java/
/*.java

Any advice or help, please?

Error downloading node: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException

Updating Maven plugin version from 0.19 to 0.21 introduces changes to the way the node is downloaded.

Since I am using a proxy, I get current error now:

...
Caused by: org.apache.maven.plugin.MojoExecutionException: Error downloading node
...
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
...
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
...
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
...

@jhaber Can you introduce a way to manage downloads when using a proxy?

Full log detail

[INFO] --- prettier:0.21:write (default) @ test ---
[DEBUG] Dependency collection stats {ConflictMarker.analyzeTime=18400, ConflictMarker.markTime=15500, ConflictMarker.nodeCount=11, ConflictIdSorter.graphTime=7700, ConflictIdSorter.topsortTime=8900, ConflictIdSorter.conflictIdCount=7, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=135900, ConflictResolver.conflictItemCount=9, DfDependencyCollector.collectTime=11118100, DfDependencyCollector.transformTime=205100}
[DEBUG] com.hubspot.maven.plugins:prettier-maven-plugin:jar:0.21
[DEBUG]    com.squareup.okhttp3:okhttp:jar:4.9.3:compile
[DEBUG]       com.squareup.okio:okio:jar:2.8.0:compile
[DEBUG]          org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.4.0:compile
[DEBUG]       org.jetbrains.kotlin:kotlin-stdlib:jar:1.4.10:compile
[DEBUG]          org.jetbrains:annotations:jar:13.0:compile
[DEBUG]    org.apache.commons:commons-compress:jar:1.21:compile
[DEBUG] Created new class realm plugin>com.hubspot.maven.plugins:prettier-maven-plugin:0.21
[DEBUG] Importing foreign packages into class realm plugin>com.hubspot.maven.plugins:prettier-maven-plugin:0.21
[DEBUG]   Imported:  < maven.api
[DEBUG] Populating class realm plugin>com.hubspot.maven.plugins:prettier-maven-plugin:0.21
[DEBUG]   Included: com.hubspot.maven.plugins:prettier-maven-plugin:jar:0.21
[DEBUG]   Included: com.squareup.okhttp3:okhttp:jar:4.9.3
[DEBUG]   Included: com.squareup.okio:okio:jar:2.8.0
[DEBUG]   Included: org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.4.0
[DEBUG]   Included: org.jetbrains.kotlin:kotlin-stdlib:jar:1.4.10
[DEBUG]   Included: org.jetbrains:annotations:jar:13.0
[DEBUG]   Included: org.apache.commons:commons-compress:jar:1.21
[DEBUG] Loading mojo com.hubspot.maven.plugins:prettier-maven-plugin:0.21:write from plugin realm ClassRealm[plugin>com.hubspot.maven.plugins:prettier-maven-plugin:0.21, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@1d44bcfa]
[DEBUG] Configuring mojo execution 'com.hubspot.maven.plugins:prettier-maven-plugin:0.21:write:default' with basic configurator -->
[DEBUG]   (f) disableGenericsLinebreaks = false
[DEBUG]   (f) extractPrettierToTargetDirectory = false
[DEBUG]   (f) ignoreConfigFile = false
[DEBUG]   (f) ignoreEditorConfig = false
[DEBUG]   (f) inputGlobs = []
[DEBUG]   (f) localRepository = C:\Users\DFranco1\.m2\repository
[DEBUG]   (f) nodeVersion = 16.13.2
[DEBUG]   (f) prettierJavaVersion = v2.3.1
[DEBUG]   (f) printWidth = 120
[DEBUG]   (f) project = MavenProject: com.test:test:1.0.0-SNAPSHOT @ C:\Users\danielfran\IdeaProjects\test\pom.xml
[DEBUG]   (f) skip = false
[DEBUG]   (f) tabWidth = 4
[DEBUG]   (f) pluginDescriptor = Component Descriptor: role: 'org.apache.maven.plugin.Mojo', implementation: 'com.hubspot.maven.plugins.prettier.CheckMojo', role hint: 'com.hubspot.maven.plugins:prettier-maven-plugin:0.21:check'
role: 'org.apache.maven.plugin.Mojo', implementation: 'com.hubspot.maven.plugins.prettier.PrintArgsMojo', role hint: 'com.hubspot.maven.plugins:prettier-maven-plugin:0.21:print-args'
role: 'org.apache.maven.plugin.Mojo', implementation: 'com.hubspot.maven.plugins.prettier.WriteMojo', role hint: 'com.hubspot.maven.plugins:prettier-maven-plugin:0.21:write'
---
[DEBUG] -- end configuration --
[DEBUG] Determined os: WINDOWS_X64
[DEBUG] Downloading node from url: https://nodejs.org/dist/v16.13.2/node-v16.13.2-win-x64.zip
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.032 s
[INFO] Finished at: 2023-10-10T13:50:08+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.21:write (default) on project test: Error downloading node: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.21:write (default) on project test: Error downloading node
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error downloading node
    at com.hubspot.maven.plugins.prettier.PrettierArgs.downloadNode (PrettierArgs.java:165)
    at com.hubspot.maven.plugins.prettier.PrettierArgs.resolveNodeInstall (PrettierArgs.java:111)
    at com.hubspot.maven.plugins.prettier.AbstractPrettierMojo.basePrettierCommand (AbstractPrettierMojo.java:106)
    at com.hubspot.maven.plugins.prettier.AbstractPrettierMojo.execute (AbstractPrettierMojo.java:46)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.ssl.Alert.createSSLException (Alert.java:131)
    at sun.security.ssl.TransportContext.fatal (TransportContext.java:371)
    at sun.security.ssl.TransportContext.fatal (TransportContext.java:314)
    at sun.security.ssl.TransportContext.fatal (TransportContext.java:309)
    at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts (CertificateMessage.java:1357)
    at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate (CertificateMessage.java:1232)
    at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume (CertificateMessage.java:1175)
    at sun.security.ssl.SSLHandshake.consume (SSLHandshake.java:396)
    at sun.security.ssl.HandshakeContext.dispatch (HandshakeContext.java:480)
    at sun.security.ssl.HandshakeContext.dispatch (HandshakeContext.java:458)
    at sun.security.ssl.TransportContext.dispatch (TransportContext.java:201)
    at sun.security.ssl.SSLTransport.decode (SSLTransport.java:172)
    at sun.security.ssl.SSLSocketImpl.decode (SSLSocketImpl.java:1505)
    at sun.security.ssl.SSLSocketImpl.readHandshakeRecord (SSLSocketImpl.java:1420)
    at sun.security.ssl.SSLSocketImpl.startHandshake (SSLSocketImpl.java:455)
    at sun.security.ssl.SSLSocketImpl.startHandshake (SSLSocketImpl.java:426)
    at okhttp3.internal.connection.RealConnection.connectTls (RealConnection.kt:379)
    at okhttp3.internal.connection.RealConnection.establishProtocol (RealConnection.kt:337)
    at okhttp3.internal.connection.RealConnection.connect (RealConnection.kt:209)
    at okhttp3.internal.connection.ExchangeFinder.findConnection (ExchangeFinder.kt:226)
    at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection (ExchangeFinder.kt:106)
    at okhttp3.internal.connection.ExchangeFinder.find (ExchangeFinder.kt:74)
    at okhttp3.internal.connection.RealCall.initExchange$okhttp (RealCall.kt:255)
    at okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.kt:32)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.kt:95)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.kt:83)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.kt:76)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp (RealCall.kt:201)
    at okhttp3.internal.connection.RealCall.execute (RealCall.kt:154)
    at com.hubspot.maven.plugins.prettier.internal.NodeDownloader.downloadToTmpFile (NodeDownloader.java:81)
    at com.hubspot.maven.plugins.prettier.internal.NodeDownloader.download (NodeDownloader.java:46)
    at com.hubspot.maven.plugins.prettier.internal.NodeDownloader.download (NodeDownloader.java:35)
    at com.hubspot.maven.plugins.prettier.PrettierArgs.downloadNode (PrettierArgs.java:163)
    at com.hubspot.maven.plugins.prettier.PrettierArgs.resolveNodeInstall (PrettierArgs.java:111)
    at com.hubspot.maven.plugins.prettier.AbstractPrettierMojo.basePrettierCommand (AbstractPrettierMojo.java:106)
    at com.hubspot.maven.plugins.prettier.AbstractPrettierMojo.execute (AbstractPrettierMojo.java:46)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild (PKIXValidator.java:439)
    at sun.security.validator.PKIXValidator.engineValidate (PKIXValidator.java:306)
    at sun.security.validator.Validator.validate (Validator.java:264)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted (X509TrustManagerImpl.java:231)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted (X509TrustManagerImpl.java:132)
    at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts (CertificateMessage.java:1341)
    at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate (CertificateMessage.java:1232)
    at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume (CertificateMessage.java:1175)
    at sun.security.ssl.SSLHandshake.consume (SSLHandshake.java:396)
    at sun.security.ssl.HandshakeContext.dispatch (HandshakeContext.java:480)
    at sun.security.ssl.HandshakeContext.dispatch (HandshakeContext.java:458)
    at sun.security.ssl.TransportContext.dispatch (TransportContext.java:201)
    at sun.security.ssl.SSLTransport.decode (SSLTransport.java:172)
    at sun.security.ssl.SSLSocketImpl.decode (SSLSocketImpl.java:1505)
    at sun.security.ssl.SSLSocketImpl.readHandshakeRecord (SSLSocketImpl.java:1420)
    at sun.security.ssl.SSLSocketImpl.startHandshake (SSLSocketImpl.java:455)
    at sun.security.ssl.SSLSocketImpl.startHandshake (SSLSocketImpl.java:426)
    at okhttp3.internal.connection.RealConnection.connectTls (RealConnection.kt:379)
    at okhttp3.internal.connection.RealConnection.establishProtocol (RealConnection.kt:337)
    at okhttp3.internal.connection.RealConnection.connect (RealConnection.kt:209)
    at okhttp3.internal.connection.ExchangeFinder.findConnection (ExchangeFinder.kt:226)
    at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection (ExchangeFinder.kt:106)
    at okhttp3.internal.connection.ExchangeFinder.find (ExchangeFinder.kt:74)
    at okhttp3.internal.connection.RealCall.initExchange$okhttp (RealCall.kt:255)
    at okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.kt:32)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.kt:95)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.kt:83)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.kt:76)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp (RealCall.kt:201)
    at okhttp3.internal.connection.RealCall.execute (RealCall.kt:154)
    at com.hubspot.maven.plugins.prettier.internal.NodeDownloader.downloadToTmpFile (NodeDownloader.java:81)
    at com.hubspot.maven.plugins.prettier.internal.NodeDownloader.download (NodeDownloader.java:46)
    at com.hubspot.maven.plugins.prettier.internal.NodeDownloader.download (NodeDownloader.java:35)
    at com.hubspot.maven.plugins.prettier.PrettierArgs.downloadNode (PrettierArgs.java:163)
    at com.hubspot.maven.plugins.prettier.PrettierArgs.resolveNodeInstall (PrettierArgs.java:111)
    at com.hubspot.maven.plugins.prettier.AbstractPrettierMojo.basePrettierCommand (AbstractPrettierMojo.java:106)
    at com.hubspot.maven.plugins.prettier.AbstractPrettierMojo.execute (AbstractPrettierMojo.java:46)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.build (SunCertPathBuilder.java:141)
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild (SunCertPathBuilder.java:126)
    at java.security.cert.CertPathBuilder.build (CertPathBuilder.java:297)
    at sun.security.validator.PKIXValidator.doBuild (PKIXValidator.java:434)
    at sun.security.validator.PKIXValidator.engineValidate (PKIXValidator.java:306)
    at sun.security.validator.Validator.validate (Validator.java:264)
    at sun.security.ssl.X509TrustManagerImpl.checkTrusted (X509TrustManagerImpl.java:231)
    at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted (X509TrustManagerImpl.java:132)
    at sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts (CertificateMessage.java:1341)
    at sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate (CertificateMessage.java:1232)
    at sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume (CertificateMessage.java:1175)
    at sun.security.ssl.SSLHandshake.consume (SSLHandshake.java:396)
    at sun.security.ssl.HandshakeContext.dispatch (HandshakeContext.java:480)
    at sun.security.ssl.HandshakeContext.dispatch (HandshakeContext.java:458)
    at sun.security.ssl.TransportContext.dispatch (TransportContext.java:201)
    at sun.security.ssl.SSLTransport.decode (SSLTransport.java:172)
    at sun.security.ssl.SSLSocketImpl.decode (SSLSocketImpl.java:1505)
    at sun.security.ssl.SSLSocketImpl.readHandshakeRecord (SSLSocketImpl.java:1420)
    at sun.security.ssl.SSLSocketImpl.startHandshake (SSLSocketImpl.java:455)
    at sun.security.ssl.SSLSocketImpl.startHandshake (SSLSocketImpl.java:426)
    at okhttp3.internal.connection.RealConnection.connectTls (RealConnection.kt:379)
    at okhttp3.internal.connection.RealConnection.establishProtocol (RealConnection.kt:337)
    at okhttp3.internal.connection.RealConnection.connect (RealConnection.kt:209)
    at okhttp3.internal.connection.ExchangeFinder.findConnection (ExchangeFinder.kt:226)
    at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection (ExchangeFinder.kt:106)
    at okhttp3.internal.connection.ExchangeFinder.find (ExchangeFinder.kt:74)
    at okhttp3.internal.connection.RealCall.initExchange$okhttp (RealCall.kt:255)
    at okhttp3.internal.connection.ConnectInterceptor.intercept (ConnectInterceptor.kt:32)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.cache.CacheInterceptor.intercept (CacheInterceptor.kt:95)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.http.BridgeInterceptor.intercept (BridgeInterceptor.kt:83)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept (RetryAndFollowUpInterceptor.kt:76)
    at okhttp3.internal.http.RealInterceptorChain.proceed (RealInterceptorChain.kt:109)
    at okhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp (RealCall.kt:201)
    at okhttp3.internal.connection.RealCall.execute (RealCall.kt:154)
    at com.hubspot.maven.plugins.prettier.internal.NodeDownloader.downloadToTmpFile (NodeDownloader.java:81)
    at com.hubspot.maven.plugins.prettier.internal.NodeDownloader.download (NodeDownloader.java:46)
    at com.hubspot.maven.plugins.prettier.internal.NodeDownloader.download (NodeDownloader.java:35)
    at com.hubspot.maven.plugins.prettier.PrettierArgs.downloadNode (PrettierArgs.java:163)
    at com.hubspot.maven.plugins.prettier.PrettierArgs.resolveNodeInstall (PrettierArgs.java:111)
    at com.hubspot.maven.plugins.prettier.AbstractPrettierMojo.basePrettierCommand (AbstractPrettierMojo.java:106)
    at com.hubspot.maven.plugins.prettier.AbstractPrettierMojo.execute (AbstractPrettierMojo.java:46)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
    at org.codehaus.classworlds.Launcher.main (Launcher.java:47)

posix:permissions error during run

Hi,
I was looking forward to try your plugin but i ran direclty in the following error:

Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.6:write (default) on project my-test-project: Execution default of goal com.hubspot.maven.plugins:prettier-maven-plugin:0.6:write failed: 'posix:permissions' not supported as initial attribute

Add license to pom.xml

Problem

My enterprise's Maven repository manager automatically rejects requesting this package since it does not contain a license property in the pom, though one is provided in this Github repo.

Solution

A license property should be added to pom.xml like so:

<project ...>
    ...
    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>
    ...
</project>

Update prettier-java to support java 15

Hi!

Thank you for this cool maven plugin!
I would love to use it in a project with java 15.
But it fails with Error: Sad sad panda, parsing errors detected due to a multi line text block.

I guess that updating prettier-java to v1.0.0 or higher will fix this.

Thank you in advance

Markdown support

Though it might be out of scope for this project, it would be great to support Markdown formatting along with Java.

Java 15 multi-line strings

The parser for prettier doesn't like Java 15 multi-line strings. To wit:

public class Java15 {
    public static void main(String[] args) {
        Object x = 7;
        final var javaVersion = System.getProperty("java.version");
        if (null != javaVersion) x = """
                Uncle
                Bob says: %s""".formatted(javaVersion);
        if (x instanceof String msg) out.println(new Fooby<>(3, msg));
    }
}

produces:

[ERROR] [error] src/main/java/hm/binkley/Java15.java: Error: Sad sad panda, parsing errors detected in line: 13, column: 40!
[ERROR] [error] Expecting --> ';' <-- but found --> '"
[ERROR] [error]                 Uncle
[ERROR] [error]                 Bob says: %s"' <--!

(The sample code was to try out some Java 15 features, hence it's unseriousness.)

record keyword breaks build

Hi there,

We're trying to add this plugin to a Java 17 project that includes record's. Currently we're getting an error like this on mvn prettier:write

[ERROR] ***.java: Error: Sad sad panda, parsing errors detected in line: 32, column: 8!
[ERROR] Expecting: one of these possible Token sequences:
[ERROR]   1. ['interface']
[ERROR]   2. ['@']
[ERROR] but found: 'record'!
[ERROR]         ->compilationUnit
[ERROR]         ->ordinaryCompilationUnit
[ERROR]         ->typeDeclaration
[ERROR]         ->interfaceDeclaration
[ERROR]     at Object.parse (<snip>\prettier-maven-plugin\0.17\prettier-maven-plugin-0.17-prettier-java-0.7.0\prettier-java\node_modules\java-parser\src\index.js:40:11)

Is it possible this plugin needs to be updated to use the latest version of prettier-java?

Version 18 does not reformat code but version 16 does

Version 18 does not reformat my code whereas version 16 does.

Here's my configuration that works (following README.md)

      <plugin>
        <groupId>com.hubspot.maven.plugins</groupId>
        <artifactId>prettier-maven-plugin</artifactId>
        <version>0.16</version>
        <configuration>
          <prettierJavaVersion>1.5.0</prettierJavaVersion>
          <ignoreConfigFile>true</ignoreConfigFile>
          <ignoreEditorConfig>true</ignoreEditorConfig>
        </configuration>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>${plugin.prettier.goal}</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

with this config, mvn verify reformats my code as expected ✅

However, if I change to v18:

[...]
 <version>0.18</version>
    <configuration>
      <prettierJavaVersion>1.6.2</prettierJavaVersion>
[...]

mvn verify does not reformat my code. I don't see any complaints - it just doesn't do anything.
mvn prettier:print-args seems happy enough (?)

I see from the PR Notes

users will need to migrate to a proper prettier-java release before upgrading to this version

Is there some extra manual step I need to perform to use v18 ?

Support zipped Node executables

My company’s internal Maven repo server is having trouble hosting exe artifacts. Would it be possible to convert the Node dependencies to zipped versions similar to how the prettier-Java dependencies are managed? Also, it would reduce the Linux node executable from 44MB to about 16MB.

Outputs violating files when running `check`

Issue came out of #48

Currently running check will simply fail the goal without listing any specific non-java files. Would be nice to see them.

admin@admins project % mvn prettier:check
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building project 0.1.1
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- prettier-maven-plugin:0.14:check (default-cli) @ project ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 42.415 s
[INFO] Finished at: 2021-07-14T11:50:03-04:00
[INFO] Final Memory: 14M/50M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.14:check (default-cli) on project bridge: Error trying to run prettier-java: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Cannot generate diff under windows

Prettier-maven-plugin version 0.7.0

# Environment
# Maven --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: D:\App\Maven
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: D:\App\Java\jdk1.8.0_45_x64\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows server 2012 r2", version: "6.3", arch: "amd64", family: "dos"

# git --version
git version 2.14.1.windows.1

When generateDiff option is set to true, the generate diff crashes with the following error message

[ERROR] Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.7:check (default-cli) on project org.project: Error trying to create diff with prettier-java: Can
not run program "/bin/sh" (in directory "D:\temp\project"): CreateProcess error=2, The system cannot find the file specified -> [Help 1]

Using git bash window, sh is defined under "/usr/bin/sh instead of /bin/sh as defined in DefaultDiffGenerator.

What about adding an optional maven option to define the sh path? I could do it if you want.

Error for Java 14 Switch

Unfortunately, Prettier does not work with the "switch" expression in Java 14:

public String foo(int number) {
    return switch (number) {
        case 1 -> "one";
        case 5 -> "five";
        case 10 -> "ten";
    }
}
[ERROR] [error] src/Foo.java: Error: Sad sad panda, parsing errors detected in line: 44, column: 30!
[ERROR] [error] Expecting: one of these possible Token sequences:
[ERROR] [error]   1. ['(']
[ERROR] [error]   2. [Identifier]
[ERROR] [error]   3. ['UnaryPrefixOperator']
[ERROR] [error]   4. ['DecimalLiteral']
[ERROR] [error]   5. ['HexLiteral']
[ERROR] [error]   6. ['OctalLiteral']
[ERROR] [error]   7. ['BinaryLiteral']
[ERROR] [error]   8. ['FloatLiteral']
[ERROR] [error]   9. ['HexFloatLiteral']
[ERROR] [error]   10. ['true']
[ERROR] [error]   11. ['false']
[ERROR] [error]   12. ['CharLiteral']
[ERROR] [error]   13. ['StringLiteral']
[ERROR] [error]   14. ['null']
[ERROR] [error]   15. ['this']
[ERROR] [error]   16. ['void']
[ERROR] [error]   17. ['byte']
[ERROR] [error]   18. ['short']
[ERROR] [error]   19. ['int']
[ERROR] [error]   20. ['long']
[ERROR] [error]   21. ['char']
[ERROR] [error]   22. ['float']
[ERROR] [error]   23. ['double']
[ERROR] [error]   24. ['boolean']
[ERROR] [error]   25. ['@']
[ERROR] [error]   26. [Identifier]
[ERROR] [error]   27. ['super']
[ERROR] [error]   28. ['(']
[ERROR] [error]   29. ['new']
[ERROR] [error] but found: 'switch'!

Can we avoid formatting the generated sources ?

Hi,

I embed maven-source-plugin to get a sources jar, it contains also the generated sources (I generate a bunch of java soap services from wsdl). The plugin parses them every time, which is a waste of time. Do you have any idea how I could avoid it ?

BR,
Gregory

Cannot find Module 'bin-prettier.js'

Hi,
I added this maven plugin to my multi module configuration today, and somehow it worked exactly once. From there on the only output I get is

[DEBUG] Loading mojo com.hubspot.maven.plugins:prettier-maven-plugin:0.19:check from plugin realm ClassRealm[plugin>com.hubspot.maven.plugins:prettier-maven-plugin:0.19, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@7e32c033]
[DEBUG] Configuring mojo execution 'com.hubspot.maven.plugins:prettier-maven-plugin:0.19:check:default-cli' with basic configurator -->
[DEBUG]   (f) diffGeneratorType = com.hubspot.maven.plugins.prettier.diff.DefaultDiffGenerator
[DEBUG]   (f) disableGenericsLinebreaks = false
[DEBUG]   (f) extractPrettierToTargetDirectory = false
[DEBUG]   (f) fail = true
[DEBUG]   (f) generateDiff = false
[DEBUG]   (f) ignoreConfigFile = false
[DEBUG]   (f) ignoreEditorConfig = false
[DEBUG]   (f) inputGlobs = [**/*.java, **/*.java]
[DEBUG]   (f) localRepository = /Users/<user>/.m2/repository
[DEBUG]   (f) nodeVersion = 16.13.2
[DEBUG]   (f) prettierJavaVersion = 2.2.0
[DEBUG]   (f) project = MavenProject: org.mueller:Skyline:1.0-SNAPSHOT @ <pom>
[DEBUG]   (f) skip = false
[DEBUG]   (f) pluginDescriptor = Component Descriptor: role: 'org.apache.maven.plugin.Mojo', implementation: 'com.hubspot.maven.plugins.prettier.CheckMojo', role hint: 'com.hubspot.maven.plugins:prettier-maven-plugin:0.19:check'
role: 'org.apache.maven.plugin.Mojo', implementation: 'com.hubspot.maven.plugins.prettier.PrintArgsMojo', role hint: 'com.hubspot.maven.plugins:prettier-maven-plugin:0.19:print-args'
role: 'org.apache.maven.plugin.Mojo', implementation: 'com.hubspot.maven.plugins.prettier.WriteMojo', role hint: 'com.hubspot.maven.plugins:prettier-maven-plugin:0.19:write'
---
[DEBUG] -- end configuration --
[DEBUG] Determined os: MAC_X64
[DEBUG] Reusing cached node at: /Users/<user>/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.19/node-v16.13.2-darwin-x64
[DEBUG] Reusing cached prettier-java at: /Users/<user>/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.19/prettier-java-2.2.0
[DEBUG] Running prettier with args: /Users/<user>/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.19/node-v16.13.2-darwin-x64/bin/node /Users/<user>/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.19/prettier-java-2.2.0/node_modules/prettier/bin-prettier.js --plugin=/Users/<user>/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.19/prettier-java-2.2.0/node_modules/prettier-plugin-java --color --check **/*.java **/*.java
[DEBUG] Prettier output >node:internal/modules/cjs/loader:936
[DEBUG] Prettier output >  throw err;
[DEBUG] Prettier output >  ^
[DEBUG] Prettier output >
[DEBUG] Prettier output >Error: Cannot find module '/Users/jannes/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.19/prettier-java-2.2.0/node_modules/prettier/bin-prettier.js'
[DEBUG] Prettier output >    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
[DEBUG] Prettier output >    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
[DEBUG] Prettier output >(node:internal/modules/run_main:81:12)
[DEBUG] Prettier output >    at node:internal/main/run_main_module:17:47 {
[DEBUG] Prettier output >  code: 'MODULE_NOT_FOUND',
[DEBUG] Prettier output >  requireStack: []
[DEBUG] Prettier output >}
[DEBUG] Prettier exit code: 1

I checked the paths in question and it seems like bin-prettier.js is indeed missing. I run this on a mac, but my ci pipeline runs on linux and it fails in the same way.

Thanks!

Format files in /src/integration-test/java

We format our code with maven mvn prettier:write

Unfortunetly the maven plugin does not work in our gitlab-ci pipeline hence we use the npm package with
prettier --check --config ./.prettierrc.yml --no-editorconfig "**/*.java" in gitlab-ci.

That way we figured out, that the npm package does find issues within the folder
/src/integration-test/java. Those files seems to be not formatted with the maven plugin.
The integration-test folder is created with build-helper-maven-plugin.

Snipped from pom.xml

<!-- Prettier Formatter -->
<plugin>
	<groupId>com.hubspot.maven.plugins</groupId>
	<artifactId>prettier-maven-plugin</artifactId>
	<version>0.11</version>
	<configuration>
		<ignoreEditorConfig>true</ignoreEditorConfig>
		<nodeVersion>12.13.0</nodeVersion>
		<prettierJavaVersion>0.8.3</prettierJavaVersion>
	</configuration>
</plugin>

Fail Maven goal when Prettier commands exit with nonzero code

In #91, the Prettier error was "hidden" by the Maven plugin (only visible when enabling debug mode, after noticing that formatting/checks were not actually being performed). I am assuming that this means other Prettier command failures would result in similar behavior, where the plugin goals appear to execute successfully, despite the underlying execution of the Prettier command(s) failing. It seems like it would be better if the exit code of the Prettier commands were checked, and if nonzero, an error were thrown containing the Prettier error output (that is currently being logged as debug).

support "local" node

Hi,

firstly, thanks for this plugin! We would like to use this plugin in our CI pipeline in which we use Alpine Container Images. Unfortunately the currently available Node 8 & 10 binaries doesn't work in Alpine. To use the plugin in Alpine, we have to replace the plugin node binaries with the Alpine node binaries (installed with apk add nodejs).

[ERROR] Failed to execute goal com.hubspot.maven.plugins:prettier-maven-plugin:0.10:check (default-cli) on project *******: Error trying to run prettier-java: Cannot run program "/home/maven/.m2/repository/com/hubspot/maven/plugins/prettier-maven-plugin/0.10/prettier-maven-plugin-0.10-node-12.13.0-linux.exe" (in directory "/"): error=2, No such file or directory -> [Help 1]

Instead of adding the Alpine binaries to the project, we thought about supporting a local node. What do you think about to introduce new cli option like prettier.nodePath where?

Cannot get plugin goals to execute in linked phase

greetings..

first off, little disclaimer: I am a web dev, not too familiar with Java.. now my work colleagues do write Java apps, but they don't have much knowledge of Maven. if you think this sounds like a recipe for disaster, you're probably not wrong. but we do what we can with what we have. 👍🏼

we recently migrated some projects from a Netbeans-dependant Ant build process, over to Maven. I personally prefer to use VSCode with Prettier, but we have issue now with different code formatting rules in the different IDEs.

I've been trying to execute the check goal from the prettier-maven-plugin automatically, but I'm just not winning.

if I understand correctly, running mvn validate with the following in my pom.xml "plugins" node should execute the prettier:check goal as well:

<plugin>
  <groupId>com.hubspot.maven.plugins</groupId>
  <artifactId>prettier-maven-plugin</artifactId>
  <version>0.14</version>
  <configuration>
    <prettierJavaVersion>1.3.0</prettierJavaVersion>
  </configuration>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
        <goal>check</goal>
      </goals>
    </execution>
  </executions>
</plugin>

or am I missing something here?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.