我有一个maven项目,该项目将一个角度应用程序构建为其webapp的一部分。
树:
+---main
| +---java
| \---webapp
| +---e2e
| | \---src
| +---src
| | +---app
| | | +---folder
| | | +---shared
| | | \---tests
| | +---assets
| | | \---images
| | +---environments
| | +---styles
| | \---temp
| \---WEB-INF
\---test
POM:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>app-client-webapp</artifactId>
<packaging>war</packaging>
<name>APP-CLIENT-WEBAPP</name>
<properties>
<war.source.dir>target/dist</war.source.dir>
<war.contextpath>app</war.contextpath>
<ng.base-href>/${war.contextpath}/app-client-webapp/</ng.base-href>
</properties>
<build>
<finalName>app-client</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.plugin.exec-maven-plugin}</version>
<executions>
<execution>
<id>exec-npm-install</id>
<phase>generate-sources</phase>
<configuration>
<executable>npm</executable>
<workingDirectory>src/main/webapp</workingDirectory>
<arguments>
<argument>install</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>angular-cli install</id>
<phase>generate-sources</phase>
<configuration>
<workingDirectory>src/main/webapp</workingDirectory>
<executable>npm</executable>
<arguments>
<argument>install</argument>
<argument>--no-optional</argument>
<argument>-g</argument>
<argument>@angular/cli</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
<execution>
<id>exec-npm-ng-build</id>
<phase>generate-sources</phase>
<configuration>
<workingDirectory>src/main/webapp/src</workingDirectory>
<executable>ng</executable>
<arguments>
<argument>build</argument>
<argument>--no-progress</argument>
<argument>--base-href=${ng.base-href}</argument>
<argument>--output-path=${project.basedir}/${war.source.dir}/${artifactId}</argument>
</arguments>
</configuration>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Build WAR -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${version.plugin.maven-war-plugin}</version>
<configuration>
<warSourceDirectory>${war.source.dir}</warSourceDirectory>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
<webResources>
<resource>
<directory>${war.source.dir}</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
<resource>
<directory>src/main/webapp/WEB-INF</directory>
<targetPath>WEB-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.tuckey</groupId>
<artifactId>urlrewritefilter</artifactId>
<version>4.0.3</version>
</dependency>
</dependencies>
</project>
现在的问题是在构建mvn clean install
时会在webapp子目录中创建一个文件夹“ node_modules”。
在那里,似乎存在构建它所需的所有节点模块。
但这正被我的IDE(IntelliJ)索引,并且正在消耗性能。
是否可以将这个文件夹移动到另一个目录(例如java目标文件夹)以使其不被索引?
过去,同一个文件夹中也有dist文件夹,但是使用ng参数可以将其更改为目标目录。
更改工作目录只会使其失败。
有任何想法吗?