【发布时间】:2021-03-26 18:12:44
【问题描述】:
我有一个 maven 插件,我想通过提供一个指向依赖 jar 中的文件/目录的路径来配置它。
这是我的 maven 项目 pom.xml 的示例。它有一个带有依赖项的插件,该插件有一个属性作为其execution 的一部分,称为templateDirectory。我想在此处放置插件依赖项mylang-swagger-codegen 的路径到依赖项内的文件/目录
{ Some path }/src/resources/api/
我怎样才能到达这条路?我了解${project.basedir} 之类的参考资料可以参与该项目。有没有办法可以引用依赖项并在 jar 中访问我想要的文件/目录?
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.4.19</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/api/swagger.yaml</inputSpec>
<language>myLang</language>
<templateDirectory> <!-- Path here to api.mustache --> </templateDirectory>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>mylang-swagger-codegen</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
【问题讨论】:
-
您需要将其作为资源加载。
-
@JFabianMeier 你能解释一下在我的情况下这意味着什么