Open TheKvist opened 3 years ago
If you use plugin then you have to care about all dependencies on your own. On the other hand plugin has generated all needed dependecies for you. This what I get when I run mvn clean install
for yours sample. That generated pom.xml
has all necesary dependencies
I see, thanks for that information. I falsely made the assumption that Maven would be installing the dependencies from the generated POM so the first mvn clean install
does not fail with the missing symbols errors.
So if I got it right the procedure is to actually have the first compile
fail, then copy the generated dependencies in my root POM, then execute the command again? Or do I need so separately install
the generated code?
yeah, you can do that. mvn clean compile
, then check newly generated pom.xml
add copy all required dependencies to yours pom.xml
Is there a way to configure maven to automatically unify the project pom.xml
with the generated one? Something like @TheKvist expected
Description
When copying the
plugin
-Block from the Usage-Example of theopenapi-generator-maven-plugin
's README into a completely empty POM and executingmvn clean compile
as instructed, the execution fails when themaven-compiler-plugin
tries to compile the newly generated sources and, of course, can't find the packages referenced in those sources, such asgson
,okio
, etc.:So the plugin basically does what it's supposed to do, but the Maven compiler afterwards seems to be thrown off by the newly introduced code. The Plugin's README unfortunately does not seem to be addressing this issue.
Am I supposed to manually add those dependencies to my root POM and retry compiling until it works or am I missing some crucial configuration or knowledge about Maven's lifecycle?
Since the plugin generates a full project including POM which has those dependencies defined, I expected them to be transitively installed during compilation, but this does not seem to be the case. Even if they're installed in my local repository, I get the same error.
openapi-generator version
Tried with version
5.0.0
and any version above and including4.0.0
Maven Version:
3.0.5
Java Version:1.8.0_202
OpenAPI declaration file content or url
To test, I've used the official v3.0 Petstore example right from the master-Branch here on GitHub. I expect this spec to be valid and it seems to be, as the actual generation is not the problem.
Generation Details
A miminum sample repository can be found here.
The only step executed here is
mvn clean compile
.Steps to reproduce
mvn clean compile
Related issues/PRs
I've looked for both, open and closed issues containing the terms "maven", "plugin", and "symbol", but could not find any issues that seem to describe my issue. So I think what I'm experiencing is simply a configuration error, but I can't explain what I've missed since I didn't actually configure anything.
Suggest a fix
Unfortunately, I have only very little experience with Maven plugins and code generation with them in particular, so I don't know what to look for, here.