简体   繁体   English

如何在pom.xml中设置路径变量-Maven

[英]How to Set Path Variable in pom.xml - Maven

I am trying to build a angular project through maven. 我正在尝试通过Maven建立一个有角度的项目。 here are my steps 这是我的步骤

npm install
bower install
grunt build

first two are successful, during the third step, i am getting compass not found error. 前两个成功,在第三步中,我遇到指南针未找到错误。

i am able to run successfully in my local as Ruby is added in PATH but in Jenkin server it is failing as no PATH set up. 我能够在本地成功运行,因为在PATH中添加了Ruby,但在Jenkin服务器中却失败了,因为未设置PATH。

I am looking for a option to pass the environmental variable -PATH through pom.xml. 我正在寻找通过pom.xml传递环境变量-PATH的选项。 can some one advice me how i can do that? 有人可以建议我该怎么做吗?

<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 [ just looking maven version of the below code ] Ant Equavelent [只看下面代码的Maven版本]

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

this helped to solve the issue. 这有助于解决问题。

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM