java - Maven无法解决vaadin依赖

标签 java maven vaadin netbeans-8

我使用 NetBeans 8,并使用 Vaadin 框架一段时间,但今天遇到此错误:

    cd /Users/BlackSheepII/Sites/microapplicazione/sprint 2/microapplicazione2/microapplicazione2-ui; JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home "/Applications/NetBeans/NetBeans 8.0.1.app/Contents/Resources/NetBeans/java/maven/bin/mvn" clean install
Scanning for projects...

------------------------------------------------------------------------
Building microapplicazione2 - microapplicazione2-ui 0.2
------------------------------------------------------------------------
The POM for com.loop:microapplicazione2-widgetset:jar:0.2 is missing, no dependency information available
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 0.275s
Finished at: Tue Jan 27 23:15:06 CET 2015
Final Memory: 7M/245M
------------------------------------------------------------------------
Failed to execute goal on project microapplicazione2-ui: Could not resolve dependencies for project com.loop:microapplicazione2-ui:war:0.2: Failure to find com.loop:microapplicazione2-widgetset:jar:0.2 in http://maven.vaadin.com/vaadin-addons was cached in the local repository, resolution will not be reattempted until the update interval of vaadin-addons has elapsed or updates are forced -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

我尝试按照另一个问题中的建议进行mvn clean install,但错误是相同的。

我也尝试以所有可能的方式创建项目(来自bash的maven,来自netbeans的maven原型(prototype)......)。但是,如果我使用 vaadin-archetype-clean 创建一个 Maven 项目(据我所知,没有自定义附加组件),则一切正常。

我问的是为什么以及如何解决这个问题。我认为 maven 无法解决依赖关系,也许我的 pom.xml 中缺少某些内容。

编辑 1

这是 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">
    <parent>
        <artifactId>as</artifactId>
        <groupId>com.loop</groupId>
        <version>7.0.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>as-ui</artifactId>
    <name>as-ui</name>
    <packaging>war</packaging>

    <dependencies>
        <!-- Versions for these are configured in the parent POM -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-push</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
        </dependency>

        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>as-widgetset</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- Bean validation implementation -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.1.0.CR1</version>
        </dependency>

        <!-- Testing -->
        <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>
                <configuration>
                    <!-- By attaching the classes to a separate JAR, we can import them
                        directly in the production overlay project, making it easier to compile a
                        separate widgetset for production mode. -->
                    <attachClasses>true</attachClasses>
                    <!-- Exclude some unnecessary files generated by the GWT compiler. -->
                    <packagingExcludes>WEB-INF/classes/VAADIN/gwt-unitCache/**,
                        WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
                </configuration>
            </plugin>
            <!-- The Jetty plugin allows us to easily test the development build by
                running jetty:run on the command line. -->
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.plugin.version}</version>
                <configuration>
                    <scanIntervalSeconds>2</scanIntervalSeconds>
                </configuration>
            </plugin>
            <!-- TODO remove? -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.16</version>
                <executions>
                    <execution>
                        <id>default</id>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>verify</id>
                        <goals>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

最佳答案

Maven 找不到依赖项 - com.loop:microapplicazione2-widgetset:jar:0.2,我认为这也是你的 Artifact 。您需要首先使用 mvn clean install 来构建它(这个 as-widgetset 项目,而不是 microapplicazione2-ui)(将其添加到您的本地存储库)或部署到您的 Nexus(如果您使用它)

查看您的pom.xml

<dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>as-widgetset</artifactId>
            <version>${project.version}</version>
</dependency>

这就是我所说的依赖性。在您的本地存储库中找不到它,您需要先构建它

关于java - Maven无法解决vaadin依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28181884/

相关文章:

java - 更改数组列表内的值?

java - 编译器的模糊参数,当它对我来说不模糊时

java - Maven WAR - 源代码没有被编译

java - 在 apache/tomcat 设置 (mod_jk) 后面的 Vaadin 中获取 IP 地址总是给出服务器的 IP 地址

java - 枚举的 vaadin 本地化

java - 在 Vaadin 中动态注入(inject) CSS

java - 为什么我们不应该在 catch block 中进行清理?

java - 用退格键替换换行符到上一行

java - 用eclipse安装maven

maven - Nexus Artefact 上传失败