月份: 2014-09

Plugin execution not covered by lifecycle configuration ,Maven 多source folder 插件 org.codehaus.mojo报错解决

好多网站上说得好复杂。
结果在 http://wiki.eclipse.org/M2E_plugin_execution_not_covered   上看到一句:
HINT: m2e provides a quick-fix associated with “plugin execution not covered” to easily create <pluginManagement/> elements like above.
ctrl+1   QuickFix 就能搞定的东西。。。
 
 

"No sources to compile" Maven 2.0 解决方案

Maven 默认的编译 sourceDirectory 是 src/java/main 目录 ,当此目录下无内容时,会报No sources to compile 的错误
解决方案,在build 处指定 sourceDirectory 就行了
<build>
<sourceDirectory>src</sourceDirectory>
当有多个sourceFolder 目录时,因为Maven 默认只有一个 sourceDirectory , 就需要开启插件的支持了。

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.9.1</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>some directory</source>
                ...
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>