Изменение каталога node_modules в проекте maven на целевой каталог - PullRequest
0 голосов
/ 17 ноября 2018

У меня есть проект maven, который создает угловое приложение в качестве части веб-приложения.

Дерево:

 +---main
 |   +---java
 |   \---webapp
 |       +---e2e
 |       |   \---src
 |       +---src
 |       |   +---app
 |       |   |   +---folder
 |       |   |   +---shared
 |       |   |   \---tests
 |       |   +---assets
 |       |   |   \---images
 |       |   +---environments
 |       |   +---styles
 |       |   \---temp
 |       \---WEB-INF
 \---test

РОМ:

<?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 он создает папку "node_modules" в подкаталоге webapp.
Там, похоже, есть все узлы, необходимые для его сборки.
Но это индексируется моей IDE (IntelliJ) и потребляет производительность.

Есть ли способ переместить эту папку в другой каталог (например, целевую папку Java), чтобы она не была проиндексирована?
Раньше в той же папке была и папка dist, но с аргументами ng ее можно было изменить на целевой каталог.
Изменение рабочего каталога просто приводит к сбою.
Есть идеи?

...