Skip to content

[BUG] Maven-plugin - Build fails if inputSpecs are a file from a remote URL #3841

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

Closed
RockyMM opened this issue Sep 5, 2019 · 3 comments
Closed

Comments

@RockyMM
Copy link
Contributor

RockyMM commented Sep 5, 2019

Description

If an URL is used as the inputSpecs, the build fails at the very end (all files are generated) with:

INFO] writing file D:\Projects\mdh-gen\mdh-modelgen-test\target\generated-sources\mdh\.openapi-generator-ignore
[INFO] writing file D:\Projects\mdh-gen\mdh-modelgen-test\target\generated-sources\mdh\.openapi-generator\VERSION
[ERROR] D:\Projects\mdh-gen\mdh-modelgen-test\https:\test.com\swagger\spec\mdh.yml [0:0]: unexpected error in Open-API generation
D:\Projects\mdh-gen\mdh-modelgen-test\https:\test.com\swagger\spec\mdh.yml [0:0]: unexpected error in Open-API generation


java.lang.RuntimeException: Could not find https:/test.com/swagger/spec/mdh.yml on the classpath
    at io.swagger.v3.parser.util.ClasspathHelper.loadFileFromClasspath (ClasspathHelper.java:31)
    at org.openapitools.codegen.plugin.CodeGenMojo.execute (CodeGenMojo.java:706)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
openapi-generator version

Maven plugin version

            <groupId>org.openapitools</groupId>
            <artifactId>openapi-generator-maven-plugin</artifactId>
            <version>4.1.1</version>
OpenAPI declaration file content or url

https://github.com/RockyMM/openapi-modelgen-test/blob/master/src/main/openapi/mdh.yml

Command line used for generation
mvn clean generate-sources
Steps to reproduce

In the test project above set inputSpec to be an URL of a remote file.
Run mvn clean generate-sources on the test project.

Suggest a fix

In the class:

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/CodeGenMojo.java

Seems that inputSpecFile.exists() is not doing it's job properly.

@wing328
Copy link
Member

wing328 commented Sep 6, 2019

Can you try the latest master, which should have the issue addressed?

Happy to reopen the issue if it's not the case

@wing328 wing328 closed this as completed Sep 6, 2019
@RockyMM
Copy link
Contributor Author

RockyMM commented Sep 9, 2019

I will have a busy week, so I cannot test it until next week. If the release is coming soon I could test with 4.1.2; that would be much simpler for me :)

@RockyMM
Copy link
Contributor Author

RockyMM commented Sep 9, 2019

Likely duplicate of #3440

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

No branches or pull requests

2 participants