为什么Maven在我的公司的存储库中尝试解析依赖项时没有在此项目中引用它?

时间:2016-09-27 20:43:14

标签: maven vaadin

我正在玩Vaadin并希望使用附加的widgetset。我有一个存储库规范和依赖项放入我的maven文件,我做了:

<?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.myCompany</groupId>
  <artifactId>Vaadin2</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>Vaadin2</name>

  <prerequisites>
    <maven>3</maven>
  </prerequisites>

  <properties>
    <vaadin.version>7.7.1</vaadin.version>
    <vaadin.plugin.version>7.7.1</vaadin.plugin.version>
    <jetty.plugin.version>9.3.9.v20160517</jetty.plugin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <!-- If there are no local customisations, this can also be "fetch" or "cdn" -->
    <vaadin.widgetset.mode>local</vaadin.widgetset.mode>
  </properties>

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

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

  <dependencies>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
      <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-client-compiled</artifactId>
    </dependency>
    <dependency>
      <groupId>com.vaadin</groupId>
      <artifactId>vaadin-themes</artifactId>
    </dependency>
                <dependency>
                   <groupId>org.vaadin.addons</groupId>
                   <artifactId>flexibleoptiongroup</artifactId>
                   <version>2.3.0</version>
                </dependency>
        </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <failOnMissingWebXml>false</failOnMissingWebXml>
          <!-- Exclude an unnecessary file generated by the GWT compiler. -->
          <packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-maven-plugin</artifactId>
        <version>${vaadin.plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>update-theme</goal>
              <goal>update-widgetset</goal>
              <goal>compile</goal>
              <!-- Comment out compile-theme goal to use on-the-fly theme compilation -->
              <goal>compile-theme</goal>
            </goals>
          </execution>
        </executions>
       <configuration>
        <runTarget>http://localhost:8080/Vaadin2</runTarget>
       </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <version>3.0.0</version>
        <!-- Clean up also any pre-compiled themes -->
        <configuration>
          <filesets>
            <fileset>
              <directory>src/main/webapp/VAADIN/themes</directory>
              <includes>
                <include>**/styles.css</include>
                <include>**/styles.scss.cache</include>
              </includes>
            </fileset>
          </filesets>
        </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>
    </plugins>
  </build>

  <profiles>
    <profile>
      <!-- Vaadin pre-release repositories -->
      <id>vaadin-prerelease</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>

      <repositories>
        <repository>
          <id>vaadin-prereleases</id>
          <url>http://maven.vaadin.com/vaadin-prereleases</url>
        </repository>
        <repository>
          <id>vaadin-snapshots</id>
          <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>vaadin-prereleases</id>
          <url>http://maven.vaadin.com/vaadin-prereleases</url>
        </pluginRepository>
        <pluginRepository>
          <id>vaadin-snapshots</id>
          <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
          <releases>
            <enabled>false</enabled>
          </releases>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>

</project>

然后我尝试更新小部件集,如下所示:

C:\Users\rcook\Documents\NetBeansProjects\mavenproject1\Vaadin2>mvn vaadin:update-widgetset install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Vaadin2 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://gaia.myCompany.com:9080/archiva/repository/internal/org/vaadin/addons/flexibleoptiongroup/2.3.0/flexibleoptiongroup-2.3.0.pom

[WARNING] The POM for org.vaadin.addons:flexibleoptiongroup:jar:2.3.0 is missing, no dependency information available
Downloading: http://gaia.myCompany.com:9080/archiva/repository/internal/org/vaadin/addons/flexibleoptiongroup/2.3.0/flexibleoptiongroup-2.3.0.jar

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.036s
[INFO] Finished at: Tue Sep 27 16:38:37 EDT 2016
[INFO] Final Memory: 10M/152M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Vaadin2: Could not resolve dependencies for project com.myCompany:Vaadin2:war:1.0-SNAPSHOT: Could not find artifact org.vaadin.addons:flexibleoptiongroup:jar:2.3.0 in archiva.default (http://gaia.myCompany.com:9080/archiva/repository/internal/) -> [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/DependencyResolutionException
C:\Users\rcook\Documents\NetBeansProjects\mavenproject1\Vaadin2>

gaia是我公司中为其他项目保存Maven存储库的服务器的名称,但我不明白为什么Maven坚持在那里查看,或者甚至在这个实例中它是如何知道它的。字符串'gaia'根本没有出现在settings.xml中。哪里可以获取gaia存储库的URL,所以我可以为这个项目关闭它?为什么maven不使用我在pom.xml中为此项目配置的存储库?

Windows 7,如果重要的话......

1 个答案:

答案 0 :(得分:1)

我的第一个想法是设置文件。您是否检查了mvn dependency:effective-pom以获取有关项目的更多信息,或mvn help:effective-settings了解有关设置的详细信息?