【问题标题】:Cannot run mvn vaadin:compile on Vaadin Maven project无法在 Vaadin Maven 项目上运行 mvn vaadin:compile
【发布时间】:2014-04-27 03:49:20
【问题描述】:

当我运行命令时: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。

【问题讨论】:

    标签: java eclipse maven vaadin pom.xml


    【解决方案1】:

    我不是 maven 专家,但这是我的 pom.xml,它可以工作。只需确保将&lt;version&gt; 更改为您使用的任何版本的 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>
    

    【讨论】:

    • 这对我有用,应该被选为答案。谢谢
    【解决方案2】:

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

    您现在需要在&lt;build&gt;&lt;plugins&gt; 元素中定义插件。像这样的:

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

    【讨论】:

    • &lt;!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--&gt;
    【解决方案3】:

    看看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>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-19
      • 1970-01-01
      • 2018-08-23
      • 2018-12-05
      • 1970-01-01
      • 2020-09-21
      • 1970-01-01
      相关资源
      最近更新 更多