无法运行mvn vaadin:编译Vaadin Maven项目

时间:2014-03-20 10:51:00

标签: java eclipse maven vaadin pom.xml

当我运行命令时:mvn vaadin:compile我收到此错误:

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.039s
[INFO] Finished at: Thu Mar 20 11:35:00 CET 2014
[INFO] Final Memory: 7M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'vaadin' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (D:\Users\etantaou\.m2\repository), central (http://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

我进行了搜索,发现我必须将其添加到我的pom.xml下:

<pluginManagement>
  <plugins>
    <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
    <plugin>
      <groupId>org.eclipse.m2e</groupId>
      <artifactId>lifecycle-mapping</artifactId>
      <version>1.0.0</version>
      <configuration>
        <lifecycleMappingMetadata>
          <pluginExecutions>
            <pluginExecution>
              <pluginExecutionFilter>
                <groupId>com.vaadin</groupId>
                <artifactId>
                  vaadin-maven-plugin
                </artifactId>
                <versionRange>
                  [1.0.2,)
                </versionRange>
                <goals>
                  <goal>clean</goal>
                                    <goal>resources</goal>
                                    <goal>update-theme</goal>
                                    <goal>update-widgetset</goal>
                                    <goal>compile-theme</goal>
                                    <goal>compile</goal>
                </goals>
              </pluginExecutionFilter>
              <action>
                <ignore></ignore>
              </action>
            </pluginExecution>
            <pluginExecution>
              <pluginExecutionFilter>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>
                  gwt-maven-plugin
                </artifactId>
                <versionRange>
                  [${gwt.plugin.version},)
                </versionRange>
                <goals>
                  <goal>resources</goal>
                  <goal>compile</goal>
                </goals>
              </pluginExecutionFilter>
              <action>
                <ignore></ignore>
              </action>
            </pluginExecution>
          </pluginExecutions>
        </lifecycleMappingMetadata>
      </configuration>
    </plugin>
  </plugins>
</pluginManagement>

我补充说,但我仍然得到错误。是否有任何罐子或东西需要添加才能使其工作?

有关我正在尝试在我的Vaadin项目上创建自定义小部件的信息。他们说here我必须运行vaadin:compile来编译WidgetSet。

3 个答案:

答案 0 :(得分:3)

我不是maven的专家,但这是我的pom.xml并且它有效。只需确保将<version>更改为您正在使用的任何版本的Vaadin(我的是7.1.12)。

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/webapp/VAADIN/widgetsets</directory>
                        </fileset>
                        <fileset>
                            <directory>src/main/webapp/VAADIN/gwt-unitCache</directory>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>7.1.12</version>
                <configuration>
                    <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                    <webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
                    <hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp>
                    <noServer>true</noServer>
                    <draftCompile>false</draftCompile>
                    <style>OBF</style>
                    <strict>true</strict>
                    <compileReport>true</compileReport>
                    <runTarget>http://localhost:8080/</runTarget>
                </configuration>
                <executions>
                    <execution>
                        <configuration>
                        </configuration>
                        <goals>
                            <goal>resources</goal>
                            <goal>update-widgetset</goal>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
    </pluginManagement>
</build>

答案 1 :(得分:1)

您已将插件配置放入pluginManagement部分,该部分仅定义了一些默认配置,但实际上并未使用该插件。

您现在需要在<build><plugins>元素中定义插件。像这样:

<build>
    <plugins>
        <plugin>
            <groupId>org.eclipse.m2e</groupId>
            <artifactId>lifecycle-mapping</artifactId>
        </plugin>
    </plugins>
</build>

答案 2 :(得分:0)

查看pom.xml from Vaadin's demo

可能goals不正确,请尝试以下操作:

<goals>
    <goal>resources</goal>
    <goal>update-widgetset</goal>
    <goal>compile</goal>
    <goal>update-theme</goal>
    <goal>compile-theme</goal>
</goals>