1

我想在我的应用引擎应用程序中运行 Maven。但是,我得到了这个例外:

从存储库 [本地 (C:\Users\user.m2\repository)、中央 (http://repo.maven.apache. org/maven2)]: 在任何插件库中都找不到插件

那是我的 Maven 文件:

<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>test</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>src</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>gwt-maven-plugin</artifactId>
                <configuration>
                    <webappDirectory>/test/war/WEB-INF/classes</webappDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <repositories>
        <repository>
            <id>wso2</id>
            <url>http://dist.wso2.org/maven2/</url>
        </repository>
        <repository>
            <id>maven-repository-1</id>
            <url>http://repo1.maven.org/maven2/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-servlet</artifactId>
                <version>2.5.1</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>com.google.gwt</groupId>
                <artifactId>gwt-user</artifactId>
                <version>2.5.1</version>
                <scope>provided</scope>
            </dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.12</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.webharvest.wso2</groupId>
            <artifactId>webharvest-core</artifactId>
            <version>1.0.0.wso2v1</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <!-- web harvest pom doesn't track dependencies well -->
        <dependency>
            <groupId>net.sf.saxon</groupId>
            <artifactId>saxon-xom</artifactId>
            <version>8.7</version>
        </dependency>
        <dependency>
            <groupId>org.htmlcleaner</groupId>
            <artifactId>htmlcleaner</artifactId>
            <version>1.55</version>
        </dependency>
        <dependency>
            <groupId>bsh</groupId>
            <artifactId>bsh</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <!-- jsoup HTML parser library @ http://jsoup.org/ -->
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.7.2</version>
        </dependency>
    </dependencies>
</project>   

我应该添加什么让它运行?

更新

我正在使用这个 Maven 插件,因为我得到:

项目的输出目录应设置为 /test/war/WEB-INF/classes

更新 2

    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>gwt-maven-plugin</artifactId>
        <version>2.5.1</version>
        <configuration>
            <webappDirectory>/test/war/WEB-INF/classes</webappDirectory>
        </configuration>
    </plugin>

我的例外是一样的:

项目的输出目录应设置为 /test/war/WEB-INF/classes

我的 Maven 文件:

<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>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>

<build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
        <resource>
            <directory>src</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <webappDirectory>/test/war/WEB-INF/classes</webappDirectory>
            </configuration>
        </plugin>
    </plugins>
</build>


<repositories>
    <repository>
        <id>wso2</id>
        <url>http://dist.wso2.org/maven2/</url>
    </repository>
    <repository>
        <id>maven-repository-1</id>
        <url>http://repo1.maven.org/maven2/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>2.5.1</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>2.5.1</version>
            <scope>provided</scope>
        </dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.12</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.webharvest.wso2</groupId>
        <artifactId>webharvest-core</artifactId>
        <version>1.0.0.wso2v1</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
    <!-- web harvest pom doesn't track dependencies well -->
    <dependency>
        <groupId>net.sf.saxon</groupId>
        <artifactId>saxon-xom</artifactId>
        <version>8.7</version>
    </dependency>
    <dependency>
        <groupId>org.htmlcleaner</groupId>
        <artifactId>htmlcleaner</artifactId>
        <version>1.55</version>
    </dependency>
    <dependency>
        <groupId>bsh</groupId>
        <artifactId>bsh</artifactId>
        <version>1.3.0</version>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <!-- jsoup HTML parser library @ http://jsoup.org/ -->
        <groupId>org.jsoup</groupId>
        <artifactId>jsoup</artifactId>
        <version>1.7.2</version>
    </dependency>
    <dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.1</version>

4

1 回答 1

4

您还没有提到插件的组 id 或工件 id,并且 maven 正在尝试使用 groupid。

    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>gwt-maven-plugin</artifactId>
      <version>2.5.1</version>
    </plugin>

参考

  1. 您可以在中央 maven repo找到 gwt-maven-plugin 。
  2. 关于如何使用gwt-maven-plugin 的参考。
  3. 浏览GWT+GAE 应用程序的 Google 团队 pom 示例。

注意 - 我在一个示例项目中测试了你的 pom.xml,没有发现任何错误。

<?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.insanity.example.gwt</groupId>
    <artifactId>learning</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>src</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>gwt-maven-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <webappDirectory>/test/war/WEB-INF/classes</webappDirectory>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <repositories>
        <repository>
            <id>wso2</id>
            <url>http://dist.wso2.org/maven2/</url>
        </repository>
        <repository>
            <id>maven-repository-1</id>
            <url>http://repo1.maven.org/maven2/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-servlet</artifactId>
            <version>2.5.1</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.google.gwt</groupId>
            <artifactId>gwt-user</artifactId>
            <version>2.5.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.12</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.webharvest.wso2</groupId>
            <artifactId>webharvest-core</artifactId>
            <version>1.0.0.wso2v1</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <!-- web harvest pom doesn't track dependencies well -->
        <dependency>
            <groupId>net.sf.saxon</groupId>
            <artifactId>saxon-xom</artifactId>
            <version>8.7</version>
        </dependency>
        <dependency>
            <groupId>org.htmlcleaner</groupId>
            <artifactId>htmlcleaner</artifactId>
            <version>1.55</version>
        </dependency>
        <dependency>
            <groupId>bsh</groupId>
            <artifactId>bsh</artifactId>
            <version>1.3.0</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <!-- jsoup HTML parser library @ http://jsoup.org/ -->
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.7.2</version>
        </dependency>
    </dependencies>
</project>

在此处输入图像描述

于 2013-03-18T03:33:17.893 回答