-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[BUG] [MVN Plugin] - <templateDirectory> is ignored #4208
Comments
+1 looks like it's still present in 4.2.2 as well |
This is still an issue. Adding the --debug option to Maven seems to pick up the template directory |
Any news? |
same thing with Homebrew and npm installations |
Still present in 4.3.0 |
Also have this issue, but from the cli side. Using 4.3.0 and trying to generate java. Tried using the |
i'm using
|
@adin234 please try the latest version (4.3.0) to see if it works for you. I did some tests with the latest version of the CLI and the |
You need to provide the folder with the customized templates instead. e.g.
|
The issue is not with the CLI. I did provide also the specific folder but it still doesn't work. |
Same here, but with CLI works fine. |
There is a bug under windows concerning the '/' and '\' in JAR resource paths since a classpath resource path with '\' does not work. It happened to me the same using the maven plugin. I configured a dependency to my own project containing my mustache templates (a simple maven project with the files inside <plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>4.3.1</version>
<dependencies>
<dependency>
<groupId>my.company</groupId>
<artifactId>my-generator-templates</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
...
<configuration>
...
<templateResourcePath>templates/JavaSpring</templateResourcePath>
...
</configuration>
...
</plugin> When I configured These classpath URLs have to be compiled always with the slash ('/') instead of Concerned methods: openapi-generator/org.openapitools.codegen.AbstractGenerator.getFullTemplateFile() and openapi-generator-core/org.openapitools.codegen.config.WorkflowSettings.withTemplateDir() |
It seems in the original fix it worked because there was a replacement of the file-separator in case it was NOT '/' using the method getCPResourcePath(). After a refactoring in this class |
What's the status on this ? It seems I have the same issue (Maven plugin, v4.3.0, using templateDirectory) Edit: turns out I didn't, I just had an incorrect configuration. This part of the doc is important and was relevant to my problem:
|
@jimschubert this bug is still open and directly corresponds to our conversation here: #6357 (comment) Have you had another look into it? |
@DenisKnoepfle thanks for bumping this. I never got your comment last month from the linked issue for some reason. I was having trouble reproducing the issue you'd described. I'd found it was because I was testing using git bash in Windows so I guess it uses linux file separators and was never hitting the file separator issue you'd described. When I had tested the maven plugin, I was testing I should have a fix shortly. I just need to get my Windows 10 VM to update successfully so I can test this in Windows Terminal, since I assume that's what most Windows developers would be using. I also want to be sure to test both A workaround for anyone affected may be to switch to templateDirectory like:
However, since this bug was reported 7 months before my refactor, I can't say for sure why the original implementation was failing. |
I'm running mvn install with the following configuration - but the looks like the is ignored and Template directory always defaults to embedded dir.
Here is the maven plugin section in which the templateDirectory is ignored:
openapi-generator version
I tried also earlier from 4.0.0 and above - but still the same.
Related issues/PRs
#3364
I see this issue was closed.
( but it wasn't open on the Maven plugin from the beginning )
Thanks,
Yuval Ishay
The text was updated successfully, but these errors were encountered: