Maven无法解决vaadin依赖关系

时间:2015-01-27 23:21:20

标签: 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原型......)。但是,如果我用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>

3 个答案:

答案 0 :(得分:0)

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

查看 pom.xml

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

那是依赖性,我正在谈论。它无法在您的本地仓库中找到,您需要先构建它

答案 1 :(得分:0)

您有一个父pom.xml,它可能列出了需要首先构建/安装的其他模块。

在这里猜测位置,但首先尝试以下方法:

cd /Users/BlackSheepII/Sites/microapplicazione/sprint2/microapplicazione2
mvn clean install

然后转到UI项目并尝试构建该项目。

答案 2 :(得分:0)

安装本地存储库或进行全新安装(我已经尝试过)都无法解决问题。无论如何,我尝试使用几乎与我相同的mac,它构建并运行一个空的vaadin项目。所以我再次卸载并重新安装:maven,java。有些东西改变了,我有一个编译错误。然后我把mac带到支持团队,他们残酷地重置它并给我带来一个干净的mac os安装,所以我再试一遍它的工作原理(只是jetty没有启动,但它是另一个故事,所有项目都运行在tomcat上)。 所以类路径中的某些东西可能无法正常工作。我担心我永远不会知道它是什么。但这是一个简单的配置问题。据我所知,使用maven你没有义务使用本地存储库。