我需要一個幫助。只安裝一次節點而不是每次都使用Maven構建
我使用咕嚕編譯CSS/JS
我有我的節點包,在每次構建所造成的問題,並正在採取了大量的空間在詹金斯。我正在使用maven前端插件。
我希望節點包只能在初始時創建一次,而不要在每個maven構建中再次創建。
<id>grunt</id>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.26</version>
<!-- optional -->
<configuration>
<workingDirectory>DIR
</workingDirectory>
<nodeVersion>v4.2.1</nodeVersion>
<npmVersion>3.5.1</npmVersion>
<installDirectory>node</installDirectory>
</configuration>
<executions>
<execution>
<id>node and npm install</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
<installDirectory>node</installDirectory>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
<installDirectory>node</installDirectory>
</configuration>
</execution>
<execution>
<id>grunt build</id>
<goals>
<goal>grunt</goal>
</goals>
<configuration>
<arguments>build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
我們正在用maven -P grunt進行構建。它使用每個maven構建創建和安裝節點。
對於具有全局節點,我正在嘗試maven -P grunt -g,但它不起作用。
在GitHub小組中,我看到有人提到我們無法使用maven前端插件,所以我嘗試了maven exec插件。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-dist-npm-runtime-dependency</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>node/node</executable>
<workingDirectory>dist</workingDirectory>
<arguments>
<argument>../node/npm/cli.js</argument>
<argument>install</argument>
<argument>--production</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
但我無法看到它的工作。任何人都可以幫助如何運行maven讓它爲全局節點安裝工作,而不是每個構建安裝節點?
如果有任何其他建議讓節點只安裝一次而不是全局安裝,將不勝感激。
我認爲,因爲您始終使用配置文件運行maven構建,所以它會隨着構建時間生成節點。我認爲你應該配置你的jenkins配置項只有在腳本發生某些變化時才觸發構建。默認情況下,jenkins應該運行默認的maven構建,而不是由profile來運行。 –