Set up picocli Annotation Processor in Intellij maven project with modules

Henne

I'm can't figure out how to setup picocli Anotation processor in a maven based intellij project.

Considere the following main pom:

<?xml version="1.0" encoding="UTF-8"?>

<groupId>my.group.id</groupId>
<artifactId>example</artifactId>
<version>1.0</version>
<packaging>pom</packaging>

<modules>
        <module>core</module>
        <module>util</module>
</modules>

<dependencies>
    <dependency>
        <groupId>info.picocli</groupId>
        <artifactId>picocli</artifactId>
        <version>4.5.1</version>
    </dependency>
    <!-- Other dependencies -->
</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
      <annotationProcessorPaths>
        <path>
          <groupId>info.picocli</groupId>
          <artifactId>picocli-codegen</artifactId>
          <version>4.5.1</version>
        </path>
      </annotationProcessorPaths>
      <compilerArgs>
        <arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
      </compilerArgs>
    </configuration>
        </plugin>
</build>

The picocli code is in the core module. But as soon as I add the configuration in the complier plugin all my IntlliJ configuration become invalid. It doesn't matter if I put the pico config in the main module or the core, both don't work. The core module pom is just for testing and packaging.

The code still compiles and is usable as an jar (No compile time err checking), but not in IntelliJ. The example works. But it doesn't use modules.

What can I do to fix it in intelliJ?

Henne

This seams to be an issue with IntelliJ not properly handling non standard maven projects.

A maven project that follows standard java rules:

$PROJECT
│  pom.xml
│  ReadMe.md
├─core
│  │  pom.xml
│  └─src
│      └─main
│          └─java
│              └─your
│                  └─package
│                      └──Commons_cliTest.java
│                    
└─util
    │  pom.xml
    └─src
        └─main
            └─java
                └─your
                    └─package
                       └─YourClasses.java

This works perfectly fine. You just need set the picocli config in the child module pom.

For example, put this in the core pom.xml

    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
            <annotationProcessorPaths>
                <path>
                    <groupId>info.picocli</groupId>
                    <artifactId>picocli-codegen</artifactId>
                    <version>4.5.1</version>
               </path>
            </annotationProcessorPaths>
            <compilerArgs>
                <arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
            </compilerArgs>
        </configuration>
    </plugin>

So the problem is IntelliJ related. Thanks for the help form Remko Popma to figure this out

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Annotation Processor in IntelliJ and Gradle

Annotation processor output in maven

Writing an annotation processor for maven-processor-plugin

Maven annotation processing processor not found

Integrate annotation processor into the same project

IntelliJ Idea: Maven compilation warning about supported annotation processor source version 'RELEASE_6' on Java 11

"Re-run SpringBoot Configuration Annotation Processor" in project with Groovy, IntelliJ and Gradle

How to remove Modules from a Intellij Maven Project permanently?

How to find Processor class of an annotation in Intellij IDEA?

How to set up a maven debug profile for a maven java project

Realm annotation processor error not picking up

Maven 3 - How to add annotation processor dependency?

How to show Maven multi-module project's nested-modules as top level modules in IntelliJ IDEA?

How to set up a multi-language project in IntelliJ IDEA

How to set up auto deployment of a maven project on multiple machines?

Set-up a Struts2 EAR Project with Maven 3

Maven dependencies in IntelliJ project

Build maven project in intellij

Mappping Processor as plugin in spring maven project

create intellij project and modules programmatically

How to configure for Spring Boot Configuration Annotation Processor using @ConfigurationProperties on IntelliJ?

Why annotation processor doesn't work with Maven and java11?

How to set up maven?

Can't use local annotation processor in Android kotlin project

Debug Java annotation processors using Intellij and Maven

Creating a JSF project with Maven and IntelliJ

Unable to import Maven project in Intellij

Step into another maven project with IntelliJ

IntelliJ maven project import issues

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  7. 7

    Do Idle Snowflake Connections Use Cloud Services Credits?

  8. 8

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  9. 9

    Binding element 'string' implicitly has an 'any' type

  10. 10

    BigQuery - concatenate ignoring NULL

  11. 11

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  12. 12

    In Skype, how to block "User requests your details"?

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Pandas - check if dataframe has negative value in any column

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Generate random UUIDv4 with Elm

  17. 17

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  18. 18

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  19. 19

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  20. 20

    EXCEL: Find sum of values in one column with criteria from other column

  21. 21

    How to use merge windows unallocated space into Ubuntu using GParted?

HotTag

Archive