3

我想使用插件 vaadin 时间轴,所以我必须制作gwt-maven-plugin 3.1并且我的 pom.xml 如下:

<?xml version="1.0"?>

<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>life</groupId>
<artifactId>life</artifactId>
<packaging>war</packaging>
<name>life Portlet</name>
<version>0.0.1-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<properties>
    <vaadin-widgets-dir>src/main/webapp/VAADIN/widgetsets</vaadin-widgets-dir>
</properties>
<build>
    <plugins>
        <plugin>
            <groupId>com.liferay.maven.plugins</groupId>
            <artifactId>liferay-maven-plugin</artifactId>
            <version>6.1.0</version>
            <configuration>
                <autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir>
                <liferayVersion>6.1.0</liferayVersion>
                <pluginType>portlet</pluginType>
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>1.5</source>
                <target>1.5</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-maven-plugin</artifactId>
            <version>1.0.1</version>
        </plugin>
        <!-- Compiles your custom GWT components with the GWT compiler -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.1.0-1</version>
            <configuration>
                <!-- if you don't specify any modules, the plugin will find them -->
                <!--modules> .. </modules -->
                <webappDirectory>${project.build.directory}/${project.build.finalName}/VAADIN/widgetsets</webappDirectory>
                <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                <runTarget>clean</runTarget>
                <hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
                <noServer>true</noServer>
                <port>8080</port>
                <soyc>false</soyc>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>resources</goal>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <!-- Updates Vaadin 6.2+ widgetset definitions based on project dependencies -->
        <plugin>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-maven-plugin</artifactId>
            <version>1.0.1</version>
            <executions>
                <execution>
                    <configuration>
                        <!-- if you don't specify any modules, the plugin will find them -->
                        <!-- <modules> <module>${package}.gwt.MyWidgetSet</module> </modules> -->
                    </configuration>
                    <goals>
                        <goal>update-widgetset</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>

    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings 
                only. It has no influence on the Maven build itself. -->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>
                                        org.codehaus.mojo
                                    </groupId>
                                    <artifactId>
                                        gwt-maven-plugin
                                    </artifactId>
                                    <versionRange>
                                        [2.1.0-1,)
                                    </versionRange>
                                    <goals>
                                        <goal>resources</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>com.vaadin</groupId>
                                    <artifactId>
                                        vaadin-maven-plugin
                                    </artifactId>
                                    <versionRange>
                                        [1.0.1,)
                                    </versionRange>
                                    <goals>
                                        <goal>
                                            update-widgetset
                                        </goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore></ignore>
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
<dependencies>
    <dependency>
        <groupId>com.liferay.portal</groupId>
        <artifactId>portal-service</artifactId>
        <version>6.1.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>com.liferay.portal</groupId>
        <artifactId>util-bridges</artifactId>
        <version>6.1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.vaadin.addons</groupId>
        <artifactId>vaadin-timeline-agpl-3.0</artifactId>
        <version>1.2.4</version>
    </dependency>

    <dependency>
        <groupId>com.liferay.portal</groupId>
        <artifactId>util-taglib</artifactId>
        <version>6.1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.liferay.portal</groupId>
        <artifactId>util-java</artifactId>
        <version>6.1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.portlet</groupId>
        <artifactId>portlet-api</artifactId>
        <version>2.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.4</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.0</version>
        <scope>provided</scope>
    </dependency>

    <!-- sqx -->

    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>antlr</groupId>
        <artifactId>antlr</artifactId>
        <version>2.7.6</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>aopalliance</groupId>
        <artifactId>aopalliance</artifactId>
        <version>1.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm</artifactId>
        <version>1.5.3</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>asm</groupId>
        <artifactId>asm-attrs</artifactId>
        <version>1.5.3</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.6.8</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjweaver</artifactId>
        <version>1.6.8</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>bsh</groupId>
        <artifactId>bsh</artifactId>
        <version>1.3.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>2.1_3</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.3</version>
    </dependency>

    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1</version>
    </dependency>

    <dependency>
        <groupId>commons-pool</groupId>
        <artifactId>commons-pool</artifactId>
        <version>1.5.3</version>
    </dependency>

    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
    </dependency>

    <dependency>
        <groupId>net.sf.ehcache</groupId>
        <artifactId>ehcache</artifactId>
        <version>1.2.3</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>3.3.1.GA</version>
    </dependency>

    <dependency>
        <groupId>hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>1.8.0.10</version>
    </dependency>


    <!-- <dependency> <groupId>jboss</groupId> <artifactId>jboss-backport-concurrent</artifactId> 
        <version>2.1.0.GA</version> </dependency> -->

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-parent</artifactId>
        <version>1.5.0</version>
    </dependency>


    <dependency>
        <groupId>javax.jcr</groupId>
        <artifactId>jcr</artifactId>
        <version>1.0</version>
    </dependency>

    <!-- <dependency> <groupId>javax.sql</groupId> <artifactId>jdbc-stdext</artifactId> 
        <version>2.0</version> </dependency> -->


    <dependency>
        <groupId>jdom</groupId>
        <artifactId>jdom</artifactId>
        <version>1.0</version>
    </dependency>


    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>


    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.14</version>
    </dependency>


    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4.3</version>
    </dependency>


    <dependency>
        <groupId>com.sun.portal.portletcontainer</groupId>
        <artifactId>container</artifactId>
        <version>1.1-m4</version>
    </dependency>

    <dependency>
        <groupId>postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>8.4-702.jdbc3</version>
    </dependency>



    <!-- sl4j-api-1.5.0 manquante -->

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-parent</artifactId>
        <version>1.5.0</version>
    </dependency>


    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.5.0</version>
    </dependency>


    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aspects</artifactId>
        <version>3.0.3.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>2.5.6</version>
    </dependency>


    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>2.5.6</version>
    </dependency>


    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context-support</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jms</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>javax.jms</groupId>
        <artifactId>jms</artifactId>
        <version>1.1</version>
        <scope>compile</scope>
    </dependency>

    <!-- <dependency> <groupId>org.springmodules</groupId> <artifactId>spring-modules-jbpm31</artifactId> 
        <version>0.9</version> <scope>provided</scope> </dependency> -->

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-oxm</artifactId>
        <version>1.5.0</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>2.0.4</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>2.5.6</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc-portlet</artifactId>
        <version>2.5</version>
    </dependency>

    <dependency>
        <groupId>com.atomikos</groupId>
        <artifactId>transactions-hibernate3</artifactId>
        <version>3.6.4</version>
    </dependency>

    <dependency>
        <groupId>com.atomikos</groupId>
        <artifactId>transactions-osgi</artifactId>
        <version>3.7.0</version>
    </dependency>

    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin</artifactId>
        <version>6.7.0</version>
    </dependency>

    <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>1.3.1</version>
    </dependency>




    <!-- this is the dependency to the "jar"-subproject -->


    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
      <version>1.5.9</version>
    </dependency>

    <dependency>
        <groupId>com.google.gwt</groupId>
        <artifactId>gwt-user</artifactId>
        <version>2.1.1</version>
        <scope>provided</scope>
    </dependency>

</dependencies>



<!-- Define our plugin repositories -->
<pluginRepositories>
    <pluginRepository>
        <id>Codehaus</id>
        <name>Codehaus Maven Plugin Repository</name>
        <url>http://repository.codehaus.org/org/codehaus/mojo</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>

    <pluginRepository>
        <id>codehaus-snapshots</id>
        <url>[http://nexus.codehaus.org/snapshots]</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </pluginRepository>

</pluginRepositories>

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

    <repository>
        <id>demoiselle.sourceforge.net</id>
        <name>Demoiselle Maven Repository</name>
        <url>http://demoiselle.sourceforge.net/repository/release</url>
    </repository>

</repositories>

但是当我mvn clean install构建我的项目时,控制台向我显示了这个错误:

[INFO] Unable to find resource 'org.codehaus.mojo:gwt-maven-plugin:jar:1.3-SNAPSHOT' in repository demoiselle.sourceforge.net (http://demoiselle.sourceforge.net/repository/release)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) org.codehaus.mojo:gwt-maven-plugin:jar:1.3-SNAPSHOT

 Try downloading the file manually from the project website.

Then, install it using the command: 
  mvn install:install-file -DgroupId=org.codehaus.mojo -DartifactId=gwt-maven-plugin -    Dversion=1.3-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

 Alternatively, if you host your own repository you can deploy the file there: 
  mvn deploy:deploy-file -DgroupId=org.codehaus.mojo -DartifactId=gwt-maven-plugin -Dversion=1.3-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency: 
1) com.vaadin:vaadin-maven-plugin:maven-plugin:1.0.1
2) org.codehaus.mojo:gwt-maven-plugin:jar:1.3-SNAPSHOT

 ----------
1 required artifact is missing.

for artifact: 
 com.vaadin:vaadin-maven-plugin:maven-plugin:1.0.1

from the specified remote repositories:
   demoiselle.sourceforge.net (http://demoiselle.sourceforge.net/repository/release),
   central (http://repo1.maven.org/maven2),
   Codehaus (http://repository.codehaus.org/org/codehaus/mojo),
   codehaus-snapshots ([http://nexus.codehaus.org/snapshots]),
   vaadin-snapshots (http://oss.sonatype.org/content/repositories/vaadin-snapshots/),
   vaadin-releases (http://oss.sonatype.org/content/repositories/vaadin-releases/),
   vaadin-addons (http://maven.vaadin.com/vaadin-addons)

我该如何解决这个问题?

4

3 回答 3

1

关于以前的答案:除非在您的父 POM 中定义,否则我看不到将gwt-maven-plugin依赖项放入其中的原因。pluginManagement即使在Using Vaadin with Maven一文中也没有pluginManagement.

您显然使用的是最新版本的 Vaadin (6.7.0),因此旧插件无法使用它。试试这些:

  • 最重要的:更改vaadin-maven-plugin为 1.0.2
  • 将版本更改gwt-maven-plugin为 2.3.0-1
  • gwt-user将依赖版本更改为 2.3.0

如果上述修复不起作用,请尝试通过调用创建一个新的 Vaadin 项目:

mvn archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-clean -DarchetypeVersion=LATEST -DgroupId=com.example -DartifactId=exampleArtifact -Dversion=1.0 -Dpackaging=war

并将 POM 结构和插件版本与您自己的进行比较。

于 2012-04-15T07:48:42.520 回答
0

由于 gwt-maven-plugin 最高版本为 2.4.0,因此该特定快照很可能不再存在...

尝试将依赖版本锁定为类似的版本,即 1.3.1:

<dependencyManagement>
  <dependency>
      <artifactId>gwt-maven-plugin</artifactId>
      <groupId>org.codehaus.mojo</groupId>
      <version>1.3.1</version>
  </dependency>
</dependencyManagement> 
于 2012-04-13T11:23:48.533 回答
0

您应该在 pluginManagement 块中而不是在构建区域中定义 gwt-maven-plugin。据我了解 gwt-maven-plugin 将被其他人使用,否则我将无法理解您的输出。此外,永远不要依赖插件的 SNAPSHOT 版本。修复您的插件版本,以在您的构建中获得可靠的结果。最后但并非最不重要的一点是开始使用存储库管理器(Artifactory、Archive、Nexus)来摆脱 pom.xml 中的存储库定义。让生活更听话。

于 2012-04-13T18:21:04.463 回答