【问题标题】:How to Set Path Variable in pom.xml - Maven如何在 pom.xml 中设置路径变量 - Maven
【发布时间】:2018-06-30 15:59:28
【问题描述】:

我正在尝试通过 maven 构建一个 Angular 项目。这是我的步骤

npm install
bower install
grunt build

前两个成功,在第三步中,我得到指南针未找到错误。

我能够在我的本地成功运行,因为 Ruby 已添加到 PATH 中,但在 Jenkins 服务器中它失败了,因为没有设置 PATH。

我正在寻找通过 pom.xml 传递环境变量 -PATH 的选项。有人可以建议我如何做到这一点吗?

<execution>                     
    <id>exec-grunt-build</id>
    <phase>generate-sources</phase>
    <configuration>
        <workingDirectory>${project.resourcesfolder}</workingDirectory>
        <executable>${grunt_cmd}</executable>
        <arguments>
            <argument>build</argument>
        </arguments>
        <environmentVariables>
            <path>${ruby_home}/bin</path>
        </environmentVariables>
    </configuration>
    <goals>
        <goal>exec</goal>
    </goals>
</execution>

Warning: not found: compass

Ant Equavelent [只看下面代码的 maven 版本]

<env key="PATH" path="${ruby_home}/bin"/>

【问题讨论】:

    标签: angular maven gruntjs pom.xml


    【解决方案1】:

    这有助于解决问题。

    <execution>
        <id>exec-grunt-build</id>
        <phase>generate-sources</phase>
        <configuration>
            <workingDirectory>${project.resourcesfolder}</workingDirectory>
            <executable>${grunt_command}</executable>
            <arguments>
                <argument>build</argument>
            </arguments>
            **<environmentVariables>
                <PATH>${ruby_home}\bin</PATH>
            </environmentVariables>**
        </configuration>
    
        <goals>
            <goal>exec</goal>
        </goals>
    </execution>
    

    【讨论】:

      猜你喜欢
      • 2012-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-26
      • 1970-01-01
      • 1970-01-01
      • 2013-01-17
      相关资源
      最近更新 更多