【问题标题】:Vaadin-Maven-Plugin can't find goalsVaadin-Maven-Plugin 找不到目标
【发布时间】:2019-01-17 04:35:11
【问题描述】:

我的 vaadin 项目有问题。我添加了一个在 vaadin 市场上找到的用于制作 QR 码的插件。为了让一切正常工作,我需要在这个插件中编译小部件集,但这是问题所在。

当我尝试在 Eclipse 中使用用于编译小部件集的按钮或直接使用 mvn vaadin:update-widgetset 时,我收到以下错误:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.649 s
[INFO] Finished at: 2018-08-09T18:13:34+02:00
[INFO] Final Memory: 9M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal 'update-widgetset' in plugin com.vaadin:vaadin-maven-plugin:10.0.1 among available goals copy-production-files, package-for-production -> [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/MojoNotFoundException

经过一番研究,似乎没有找到其他一些目标,因为现在当我尝试构建我的解决方案时,我遇到了类似的错误,但有另一个目标:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Padoo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.148 s
[INFO] Finished at: 2018-08-09T18:17:00+02:00
[INFO] Final Memory: 11M/155M
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal 'update-theme' in plugin com.vaadin:vaadin-maven-plugin:10.0.1 among available goals copy-production-files, package-for-production -> [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/MojoNotFoundException

显然我在我的 pom.xml 中遗漏了一些东西。我是 maven 的新手,我不知道我错过了什么。

这是我的pom:

<?xml version="1.0" encoding="UTF-8"?>
<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>com.metaverse</groupId>
    <artifactId>Padoo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>Padoo</name>
    <description></description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <vaadin.version>8.3.1</vaadin.version>
    </properties>

    <repositories>
        <repository>
            <id>vaadin-addons</id>
            <url>http://maven.vaadin.com/vaadin-addons</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
        </dependency>
        <dependency>
            <groupId>org.vaadin.addons</groupId>
            <artifactId>qrcode</artifactId>
            <version>2.1</version>
        </dependency>
        <dependency>
            <groupId>com.mvcpt</groupId>
            <artifactId>mapgenerator</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
              <groupId>com.vaadin</groupId>
              <artifactId>vaadin-maven-plugin</artifactId>
              <version>10.0.1</version>         
              <configuration>
                <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                <webappDirectory>${basedir}/target/classes/VAADIN/widgetsets</webappDirectory>
                <draftCompile>false</draftCompile>
                <compileReport>false</compileReport>
                <style>OBF</style>
                <strict>true</strict>
              </configuration>

              <executions>
                <execution>
                  <goals>
                    <goal>update-theme</goal>
                    <goal>update-widgetset</goal>
                    <goal>compile</goal>
                    <goal>compile-theme</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
        </plugins>
    </build>
</project>

【问题讨论】:

  • 根据错误信息这个插件只有目标:copy-production-files, package-for-production...
  • this site,看来OP已经设置OK了,我们的pom也设置了类似的,所以你无权访问目标很不寻常
  • 检查 vaadin-maven-plugin 的版本和你正在使用的 vaadin 版本它们不符合..我认为应该是这种情况....

标签: java maven vaadin pom.xml


【解决方案1】:

&lt;version&gt;10.0.1&lt;/version&gt; 更改为 &lt;version&gt;${vaadin.version}&lt;/version&gt; 之类的内容。您正在为 Vaadin 10 使用 Maven 插件,该插件与 Vaadin 8 的目标不同。

【讨论】: