我在Eclipse上遇到了麻烦。
我会尽力解释的。我正在做一个项目,“滥用”的maven覆盖,并有许多模块,其中有Javascript和较少的文件内的webapp。
我们设法将maven配置为分解一个目录上的依赖项,maven-frontend plugin将在该目录中处理(使用nodejs)以生成最终编译的JS和CSS文件。
当我使用纯maven时,它工作得很好。然而,在Eclipse上,这并不能正常工作。主要原因是Eclipse simple忽略了maven-war-plugin分解依赖项的执行配置。相反,它只是执行默认的maven-war-plugin:explode。
我需要修复它,因为这是获得现代前端开发环境的最大障碍(使用nodejs、npm和gulp来转换JS或更少)。
从我们的主pom.xml中提取
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>make-webapp-compress</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<mkdir dir="${project.build.directory}/webapp-exploded" />
<mkdir dir="${project.build.directory}/webapp-compress" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>parent-resources-less</id>
<phase>generate-sources</phase>
<goals>
<goal>exploded</goal>
</goals>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warSourceExcludes>**/*.ftl,**/*.vm,**/*.xml,WEB-INF/,META-INF/</warSourceExcludes>
<warSourceIncludes>**/*.css,**/*.less,**/*.js</warSourceIncludes>
<webappDirectory>${project.build.directory}/webapp-exploded</webappDirectory>
<webResources>
<resource>
<directory>src/main/webapp</directory>
</resource>
</webResources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<versionRange>[1.8,]</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<versionRange>[3.0.0,]</versionRange>
<goals>
<goal>exploded</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>发布于 2018-11-08 15:49:35
您可以尝试使用插件"maven-dependency- plugin“。我在项目中使用它将依赖项复制到所需的特定输出目标。我附上了样本配置,更新这根据您的要求。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/pipeline/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>https://stackoverflow.com/questions/52877275
复制相似问题