我想在项目中使用 wro4j maven 插件。我使用 mvn 命令行工作,但不在 Eclipse/m2e 中工作。
我尝试了生命周期映射自定义和 wroj4j-m2e 集成插件。
这是生命周期映射自定义的错误:
目标 ro.isdc.wro4j:wro4j-maven-plugin:1.6.0:run 的执行默认值:插件 ro.isdc.wro4j:wro4j-maven-plugin:1.6.0 或其依赖项之一无法解析:失败收集 ro.isdc.wro4j:wro4j-maven-plugin:jar:1.6.0 () 的依赖项 (ro.isdc.wro4j:wro4j-maven-plugin:1.6.0:run:default:process-resources)
m2eclipse 的日志(在 .plugins\org.eclipse.m2e.logback.configuration 中)关于这个错误是空的,即使在 Eclipse maven 首选项中选择了调试输出。
- m2e 版本:1.2.0.20120903-1050
- eclipse 版本:Juno Service Release 1
这是 pom.xml (摘录)
<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>
<groupId>test</groupId>
<artifactId>test-maven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<wro4j.version>1.6.0</wro4j.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<version>${wro4j.version}</version>
<executions>
<execution>
<configuration>
<destinationFolder>${project.build.directory}/</destinationFolder>
<wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
<wroFile>${basedir}/src/main/config/wro.xml</wroFile>
<extraConfigFile>${basedir}/src/main/config/wro.properties</extraConfigFile>
<targetGroups>gss</targetGroups>
<cssDestinationFolder>${project.build.directory}/${project.build.finalName}/styles/</cssDestinationFolder>
<jsDestinationFolder>${project.build.directory}/${project.build.finalName}/scripts/</jsDestinationFolder>
<contextFolder>${basedir}/src/main/</contextFolder>
<ignoreMissingResources>false</ignoreMissingResources>
<wroFile>${basedir}/src/main/config/wro.xml</wroFile>
</configuration>
<phase>process-resources</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<!-- configure #!@ m2eclipse -->
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>ro.isdc.wro4j</groupId>
<artifactId>wro4j-maven-plugin</artifactId>
<versionRange>[1.0,]</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
</execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>