我需要一个帮助。只安装一次节点而不是每次都使用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来运行。 –