Micronaut-core: io.micronaut.openapi:micronaut-openapi pom malformed

Created on 26 Dec 2020  路  4Comments  路  Source: micronaut-projects/micronaut-core

Thanks for reporting an issue, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.

NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (https://stackoverflow.com/tags/micronaut) or Gitter (https://gitter.im/micronautfw/). DO NOT use the issue tracker to ask questions.

Task List

  • [x] Steps to reproduce provided
  • [ ] Stacktrace (if present) provided
  • [ ] Example that reproduces the problem uploaded to Github
  • [x] Full description of the issue provided (see below)

Steps to Reproduce

  1. create a new maven micronaut project (micronaut 2.2.2) from https://micronaut.io/launch/ with options

    • java 11

    • maven

    • junit

    • openapi

  2. compile app (via mvn compile or mvn mn:run)

Expected Behaviour

App is compiled without error

Actual Behaviour

maven compilation fails :

$ mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< com.example:demo >--------------------------
[INFO] Building demo 0.1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ demo ---
[WARNING] Invalid POM for io.micronaut.openapi:micronaut-openapi:jar:2.2.1, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\dev\java\src\demo\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.356 s
[INFO] Finished at: 2020-12-26T22:41:10+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project demo: Fatal error compiling: java.util.ServiceConfigurationError: Err
or loading service [io.micronaut.openapi.annotation.transformers.ApiResponseRetentionPolicyAnnotationTransformer]: null: InvocationTargetException: io/swagger/v3/oas/annotations/responses/Ap
iResponse: io.swagger.v3.oas.annotations.responses.ApiResponse -> [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

io.micronaut.openapi:micronaut-openapi:2.2.1:pom relies on

    <dependency>
      <groupId>io.micronaut</groupId>
      <artifactId>micronaut-http</artifactId>
      <scope>runtime</scope>
    </dependency>

which version is not completed from the BOM (it is in dependencyManagement, but is is not used to extend this pom)

Removing this dependency from o.micronaut.openapi:micronaut-openapi:2.2.1:pom file does allow to compile here (but would cause unexpected error in a real project where I would rather import the BOM than rely on micronaut-parent I think) .
Forcing whatever existing version for micronaut-http in this same pome (I tried with 1.0.0) fixes it also for this project (the BOM specified version is actually used at runtime).

Environment Information

  • Operating System: Win10
  • Micronaut Version: 2.2.2
  • JDK Version: 11.0.9 (graal)
  • maven Version: 3.6.3

Example Application

  • use micronaut launch

Most helpful comment

Hi,

It looks this issue came back on Micronaut 2.3.0:

[WARNING] Invalid POM for io.micronaut.openapi:micronaut-openapi:jar:2.3.0, transitive dependencies (if any) will not be available, enable debug logging for more details

All 4 comments

Just reproduced with Java 15 (Corretto) / mvn 3.6.3 over Win10 and MN 2.2.2.
Additional features: graphql, h2, hibernate-validator, openapi, security-jwt, views-freemarker

Also wanted to highlight that mvn mn:run fails with explicit stack trace, which roots to
Caused by: java.lang.ClassNotFoundException: io.swagger.v3.oas.annotations.responses.ApiResponse

Looks like there is a missing runtime package in the pom.xml? What should we add?

Hi,

It looks this issue came back on Micronaut 2.3.0:

[WARNING] Invalid POM for io.micronaut.openapi:micronaut-openapi:jar:2.3.0, transitive dependencies (if any) will not be available, enable debug logging for more details

Sadly, bad this is decreases the reputation of Micronaut Framework in total. Possibly you have bad DevOps engineers (or CI/CD pipelines) that can not detect those faults early.

And I do not understand Why I'm always need to specify version of Data JPA and Open API in Micronaut in pom.xml/build.gradle which is always one major version behind Micronaut version, I don't have this issue in Spring Boot.

Was this page helpful?
0 / 5 - 0 ratings