Vaadin 14 训练“RouterAPI”可能已过时,因此 mvn jetty:run 会引发错误。我需要如何更改 POM 文件?

发布于 2025-01-11 06:09:37 字数 4943 浏览 0 评论 0原文

如前所述,我在运行 mvn jetty:run 时遇到问题,无法使用现有的 vaadin 练习在 vs code 中进行路由。由于本教程已在 vaadin 10 下创建,因此 pom 文件可能已过时,因为其他培训可以使用 mvn jetty:run 命令完美运行。 确切的错误是:

No plugin found for prefix 'jetty' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Dukatz\.m2\repository), central (https://repo.maven.apache.org/maven2)]

遗憾的是,我对网络应用程序开发还很陌生,所以我对如何使其工作一无所知。希望你能帮助我。 教程:Vaadin Router Api 教程

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.vaadin.trainings.routing</groupId>
    <artifactId>exercises-routing</artifactId>
    <name>Routing Exercises</name>
    <version>1.0.0</version>
    <packaging>war</packaging>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>

        <!-- Dependencies -->
        <vaadin.version>13.0.5</vaadin.version>
        <servlet.api.version>3.1.0</servlet.api.version>

        <!-- Plugins -->
        <jetty.version>9.4.15.v20190215</jetty.version>
        <maven.war.plugin.version>3.1.0</maven.war.plugin.version>

    </properties>

    <repositories>
        <repository>
            <id>vaadin-prereleases</id>
            <name>Vaadin Pre-releases</name>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
        </repository>
    </repositories>


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

    <dependencies>
        <!-- Added to provide logging output as Flow uses -->
        <!-- the unbound SLF4J no-operation (NOP) logger implementation -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
        
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-core</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet.api.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>${maven.war.plugin.version}</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Implementation-Title>${project.name}</Implementation-Title>
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
            </plugin>
        </plugins>
    </build>
</project>

as stated I have trouble running mvn jetty:run with the existing vaadin exercise for routing in vs code. As the tutorial was already created under vaadin 10 the pom file is probably outdated, as the other trainigs worked perfectly fine with the mvn jetty:run command.
The exact error is:

No plugin found for prefix 'jetty' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Dukatz\.m2\repository), central (https://repo.maven.apache.org/maven2)]

Sadly I'm pretty new do web application development, so I don't have the slightest idea, how to make it work. Hopefully you can help me.
The Tutorial: Vaadin Router Api Tutorial

the POM file:

<?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.vaadin.trainings.routing</groupId>
    <artifactId>exercises-routing</artifactId>
    <name>Routing Exercises</name>
    <version>1.0.0</version>
    <packaging>war</packaging>

    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <failOnMissingWebXml>false</failOnMissingWebXml>

        <!-- Dependencies -->
        <vaadin.version>13.0.5</vaadin.version>
        <servlet.api.version>3.1.0</servlet.api.version>

        <!-- Plugins -->
        <jetty.version>9.4.15.v20190215</jetty.version>
        <maven.war.plugin.version>3.1.0</maven.war.plugin.version>

    </properties>

    <repositories>
        <repository>
            <id>vaadin-prereleases</id>
            <name>Vaadin Pre-releases</name>
            <url>https://maven.vaadin.com/vaadin-prereleases</url>
        </repository>
    </repositories>


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

    <dependencies>
        <!-- Added to provide logging output as Flow uses -->
        <!-- the unbound SLF4J no-operation (NOP) logger implementation -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
        </dependency>
        
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-core</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet.api.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>${maven.war.plugin.version}</version>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Implementation-Title>${project.name}</Implementation-Title>
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
            </plugin>
        </plugins>
    </build>
</project>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

紫轩蝶泪 2025-01-18 06:09:37

pom文件没有问题。因为这是一个较旧的课程,所以没有为整个项目创建 pom 文件,而只是在特定路径(如 \exercises 或 \solutions)中创建。因此运行 mvn jetty:run 无法工作。目录中没有pom。我使用 Maven-Explorer jetty 插件在 VS-Code 中启动它,但

mvn jetty:run -f "c:\Users\Dukatz\Desktop\VadinTutorials\Vaadin14-RouterAPI\Exercises\pom.xml" 

会从命令行完成这项工作。
谢谢我!我不会删除这个问题,因为有一天也许会有像我一样愚蠢的人。

There is no Problem with the pom file. Because it's an older lesson, there was no pom file created for the whole project, but only in the specific paths (like \exercises or \solutions). So running mvn jetty:run couldn't work. There was no pom in the directory. I started it in VS-Code with the Maven-Explorer jetty plugin but

mvn jetty:run -f "c:\Users\Dukatz\Desktop\VadinTutorials\Vaadin14-RouterAPI\Exercises\pom.xml" 

would do the job from the command line.
Thanks me! I won't delete the question because, one day there's maybe someone as dumb as me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文