Vin*_*res 6 war maven node.js gruntjs bower
我有一个使用Maven和frontend-maven-plugin(com.github.eirslett)的项目.
当我运行mvn install所有的插件运行的处决,他们创造node_modules,bower_components以及node在文件夹src/main/webapp的根,而实际前端代码.
问题是,我只想在目录中生成的包中mvn install执行和创建它们,而不是在版本化的应用程序代码中,就像它对Java库一样.warbuild
有没有办法实现这一目标?
这是我的相关部分pom.xml:
<build>
<directory>build</directory>
<outputDirectory>build/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>UTF-8</encoding>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>WEB-INF/weblogic.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
...
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.20</version>
<configuration>
<workingDirectory>src/main/webapp</workingDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<configuration>
<nodeVersion>v0.10.34</nodeVersion>
<npmVersion>2.1.11</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>grunt build</id>
<goals>
<goal>grunt</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
可以使用< installDirectory >配置参数来选择安装NodeJS的位置.
frontend-maven-plugin将安装node_modules在它发现的地方package.json.这就是为什么你需要提供你的web资源的副本与 package.json一些target/<sub-path>.
然后frontend-maven-plugin可以通过这种方式配置:
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>0.0.24</version>
<configuration>
<nodeVersion>v0.11.14</nodeVersion>
<npmVersion>2.13.4</npmVersion>
<installDirectory>target/<sub-path></installDirectory>
<workingDirectory>target/<sub-path></workingDirectory>
</configuration>
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10448 次 |
| 最近记录: |