我使用Gulp,因此在我的项目中使用了Node.js。我在node_modules
内有一个src/main/resources
文件夹,每次运行mvn install
时,它将9000多个文件复制到目标文件夹。
我不要这个!如何排除node_modules
文件夹?
我尝试过:
<excludes>
<exclude>**/src/main/resources/node_modules/*</exclude>
</excludes>
还有这个
<excludes>
<exclude>node_modules/**</exclude>
</excludes>
maven-compiler-plugin的内部配置标签。但这不起作用。
有人可以解决吗?
这是我pom的构建部分
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<applications>
<application>
<applicationKey>jira-software</applicationKey>
<version>${jira.software.application.version}</version>
</application>
</applications>
<!-- Uncomment to install TestKit backdoor in JIRA. -->
<!--
<pluginArtifacts>
<pluginArtifact>
<groupId>com.atlassian.jira.tests</groupId>
<artifactId>jira-testkit-plugin</artifactId>
<version>${testkit.version}</version>
</pluginArtifact>
</pluginArtifacts>
-->
<pluginArtifacts>
<pluginArtifact>
<groupId>com.atlassian.labs.plugins</groupId>
<artifactId>quickreload</artifactId>
<version>1.30.5</version>
</pluginArtifact>
</pluginArtifacts>
<compressResources>false</compressResources>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<allowGoogleTracking>false</allowGoogleTracking>
<productDataPath>./generated-test-resources.zip
</productDataPath>
<!-- See here for an explanation of default instructions: -->
<!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<!-- Add package to export here -->
<Export-Package>
de.cschulc.jira.plugin.api,
</Export-Package>
<!-- Add package import here -->
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*;version="0";resolution:=optional,
*
</Import-Package>
<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<excludes>
<exclude>**/src/main/resources/node_modules/*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
答案 0 :(得分:1)
我建议您采用一种对我来说很好的方法。
myproject/src/main/resources
移到myproject
:当我想在本地安装模块时,从项目的根文件夹运行npm是更自然的事情,因为这是我的工作目录,请参见{{3 }} myproject/node_modules
移到myproject/target/...
答案 1 :(得分:0)
代替尝试:
<exclude>node_modules/**</exclude>
然后尝试
mvn clean process-resources -X
答案 2 :(得分:0)
我有此问题,已解决
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<warSourceExcludes>node_modules/**,build/**,config/**,src/**</warSourceExcludes>
</configuration>
</plugin>