Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI generates a non working pom.xml for cli apps (1.2.0) #2031

Closed
tommy1199 opened this issue Aug 21, 2019 · 2 comments
Closed

CLI generates a non working pom.xml for cli apps (1.2.0) #2031

tommy1199 opened this issue Aug 21, 2019 · 2 comments
Assignees
Milestone

Comments

@tommy1199
Copy link

When creating a new CLI app with help of Micronaut CLI tool (mn) and with maven as build tool, the created pom.xml is not working correctly. With Micronaut 1.1.0 it seems to work

Steps to Reproduce

  1. mn create-cli-app foo --build maven
  2. cd foo
  3. ./mvnw package

Expected Behaviour

Build runs successfully and jar file is built

Actual Behaviour

Build crashes with an exception

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project foo: Fatal error compiling: java.lang.NoClassDefFoundError: io/micronaut/inject/annotation/AnnotatedElementValidator: io.micronaut.inject.annotation.AnnotatedElementValidator -> [Help 1]

Environment Information

  • Operating System: Mac OS
  • Micronaut Version: 1.2.0
  • JDK Version: openjdk 12.0.2
@antoniocaccamo
Copy link

Hi all,
this issue can be solved putting the artifact io.micronaut.configuration:micronaut-picocli at last position of the annotation processor path, as the following code:

<plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.7.0</version>
          <configuration>
            <compilerArgs>
              <arg>-parameters</arg>
            </compilerArgs>
            <annotationProcessorPaths>
                  <path>
                    <groupId>io.micronaut</groupId>
                    <artifactId>micronaut-inject-java</artifactId>
                    <version>${micronaut.version}</version>
                  </path>
                  <path>
                    <groupId>io.micronaut</groupId>
                    <artifactId>micronaut-validation</artifactId>
                    <version>${micronaut.version}</version>
                  </path>
                  <path>
                    <groupId>io.micronaut.configuration</groupId>
                    <artifactId>micronaut-picocli</artifactId>
                    <version>${micronaut.version}</version>
                  </path>
            </annotationProcessorPaths>
          </configuration>
          <executions>
            <execution>
              <id>test-compile</id>
              <goals>
                <goal>testCompile</goal>
              </goals>
              <configuration>
                <compilerArgs>
                  <arg>-parameters</arg>
                </compilerArgs>
                <annotationProcessorPaths>

                  <path>
                    <groupId>io.micronaut</groupId>
                    <artifactId>micronaut-inject-java</artifactId>
                    <version>${micronaut.version}</version>
                  </path>

                  <path>
                    <groupId>io.micronaut</groupId>
                    <artifactId>micronaut-validation</artifactId>
                    <version>${micronaut.version}</version>
                  </path>

                  <path>
                    <groupId>io.micronaut.configuration</groupId>
                    <artifactId>micronaut-picocli</artifactId>
                    <version>${micronaut.version}</version>
                  </path>

                </annotationProcessorPaths>
              </configuration>
            </execution>
          </executions>
        </plugin>

@benrhine
Copy link
Contributor

I have tested the above mentioned solution and that does seem to resolve the issue. Someone else has also ran across this same issue as #2302 and the above solution seems to resolve it as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants