添加exec-maven-plugin的附加路径 [英] Add additional path to exec-maven-plugin

查看:1075
本文介绍了添加exec-maven-plugin的附加路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为exec-maven-plugin添加一个额外的类路径。

除了%classpath之外,我想在包含资源的目录中添加一个额外的路径(/ Users / kornp /资源)。
目前,我的pom看起来像这样:

I would like to add an additional class path to the exec-maven-plugin.
Besides the %classpath, I would like to add an extra path to a directory containing resources (/Users/kornp/resources). Currently, my pom looks like this:

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>exec-maven-plugin</artifactId>
  <version>1.1.1</version>
  <configuration>
    <executable>java</executable>
    <classpathScope>runtime</classpathScope>
    <arguments>
      <argument>%classpath:/Users/kornp/resources</argument>
      <argument>org.drrabbit.maventest.App</argument>
    </arguments>
  </configuration>
</plugin>

我该如何配置?

推荐答案

我的源文件夹之外的特定目录中有一些配置文件。所以我为我的pom.xml文件定义了额外的资源。

I have some configuration files in a specific directory outside of my source folder. So i defined additonal resources to my pom.xml file.

我的示例目录结构是:

+ src
+ conf
  - app.properties
  - log4j.xml
- pom.xml

我的pom.xml:

<build>
  <resources>
    <resource>
      <directory>conf</directory>
    </resource>
    <resource>
      <directory>src/main/resources</directory>
    </resource>
  </resources>

  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>exec-maven-plugin</artifactId>
      <version>1.2.1</version>
      <configuration>
        <executable>java</executable>
        <mainClass>com.mycompany.MyMainClass</mainClass>
      </configuration>
    </plugin>
  </plugins>
<build>

现在我们可以执行该程序:

Now we may execute the program:

mvn clean compile exec:java

这篇关于添加exec-maven-plugin的附加路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆