question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] [MVN Plugin] - <templateDirectory> is ignored

See original GitHub issue

I’m running mvn install with the following configuration - but the looks like the <templateDirectory> is ignored and Template directory always defaults to embedded dir.

Here is the maven plugin section in which the templateDirectory is ignored:

  <build>
        <plugins>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>4.1.3</version>
                <executions>
                    <execution>
                        <id>swagger-generate-server-code</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>${project.parent.parent.basedir}/src/main/resources/swagger-spec-pet-store.json</inputSpec>
                            <templateDirectory>${project.basedir}/src/main/resources</templateDirectory>
                            <modelPackage>com.computrade.restful.services.model</modelPackage>
                            <apiPackage>com.computrade.restful.services.server.api</apiPackage>
                            <invokerPackage>com.computrade.restful.services.server.invoker</invokerPackage>
                            <configOptions>
                                <interfaceOnly>true</interfaceOnly>
                                <java8>true</java8>
                                <dateLibrary>java8</dateLibrary>
                                <skipDefaultInterface>true</skipDefaultInterface>
                            </configOptions>
                            <configHelp>false</configHelp>
                            <generatorName>spring</generatorName>
                            <library>spring-boot</library>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
openapi-generator version
            <groupId>org.openapitools</groupId>
            <artifactId>openapi-generator-maven-plugin</artifactId>
            <version>4.1.3</version>

I tried also earlier from 4.0.0 and above - but still the same.

Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/3364 I see this issue was closed. ( but it wasn’t open on the Maven plugin from the beginning )

Thanks, Yuval Ishay

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
andrzejwpcommented, Dec 12, 2019

+1 looks like it’s still present in 4.2.2 as well

0reactions
jimschubertcommented, Oct 3, 2020

@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 templateDirectory rather than templateResourcePath as is discussed in this issue.

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 templateDirectory and templateResourcePath options a few times in private CI and local builds to be sure the issue is resolved.

A workaround for anyone affected may be to switch to templateDirectory like:

<templateDirectory>${project.basedir}/templates</templateDirectory>

However, since this bug was reported 7 months before my refactor, I can’t say for sure why the original implementation was failing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Apache Avro maven plugin seems to be ignoring config
Problem solved. Just move the configuration block directly under the plugin one. It seams that when you want to generate the code with...
Read more >
Guide to Configuring Plug-ins - Apache Maven
Maven plugins (build and reporting) are configured by specifying a ... is made absolute by prefixing it with the project's base directory.
Read more >
3 Using the WebLogic Development Maven Plug-In
Creates a domain for WebLogic Server using a domain template. This goal supports specifying the domain directory (the last directory determines the domain...
Read more >
Kubernetes Maven Plugin - JKube - Eclipse
When using Dockerfile mode, every file and directory present in the Docker build context directory gets copied to the created Docker image. In...
Read more >
Apache Maven Tutorial - Vogella.com
This build output should not get included into your version control system. Add this directory to your ignore resources. For example, if you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found