开发者

Maven GWT Plugin copies multiple versions of the same snapshot jars

开发者 https://www.devze.com 2023-04-06 20:23 出处:网络
I have this issue where I build my project (mvn clean install), some of the transitive dependencies are snapshot versions and are downloaded and copied into the target webapp directory e.g XXXUtil-1.0

I have this issue where I build my project (mvn clean install), some of the transitive dependencies are snapshot versions and are downloaded and copied into the target webapp directory e.g XXXUtil-1.0-20110922.172721-52.jar. Then when I run mvn gwt:run, it finds uses XXXUtil-1.0-SNAPSHOT.jar and copies it to the target webapp directory. I can't figure out why this is happening. In doesn't matter whether I run as exploded or inplace.

<plugins>
    <!-- GWT Maven Plugin -->
    <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>gwt-maven-plugin</artifactId>
            <version>2.3.0-1</version>
            <executions>
                    <execution>
                            <goals>
                                    <goal>compile</goal>
                                    <goal>i18n</goal>
                                    <goal>generateAsync</goal>
                            </goals>
                    </execution>
            </executions>
            <configuration>
                    <runTarget>Shell.html</runTarget>
                    <hostedWebapp>${webappDirectory}</hostedWebapp>
    <i18nMessagesBundle>com.myapp.client.Messages</i18nMessagesBundle>
            </configuration>
            <dependencies>
                    <dependency>
                            <groupId>com.google.gwt</groupId>
                          开发者_JAVA技巧  <artifactId>gwt-user</artifactId>
                            <version>${gwt.version}</version>
                    </dependency>
                    <dependency>
                            <groupId>com.google.gwt</groupId>
                            <artifactId>gwt-dev</artifactId>
                            <version>${gwt.version}</version>
                    </dependency>
            </dependencies>
    </plugin>

    <!-- Copy static web files before executing gwt:run -->
    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <executions>
                    <execution>
                            <phase>compile</phase>
                            <goals>
                                    <goal>exploded</goal>
                            </goals>
                    </execution>
            </executions>
            <configuration>
<!-- <outputFileNameMapping>@{artifactId}@-@{version}@.@{extension}@</outputFileNameMapping>  -->
                    <webappDirectory>${webappDirectory}</webappDirectory>
            </configuration>
    </plugin>
</plugins>

None of the suggestions described here help: http://www.tikalk.com/alm/forums/maven-war-plugin-picking-multiple-version-same-snapshot-jars.

If i build local snapshots of XXXUtil-1.0-SNAPSHOT.jar it works buts not when downloading snapshots from a nexus repository. Another way to look at it is like this Project A generates a WAR, and depends on B.jar, which depends on C.jar. When i build my war using mvn install, it generates the correct jars in WEB-INF/lib so we have C-1.0-20110922.172721-52.jar. Which is correct and it works if i deploy my war. If i run in hosted mode using eclipse, its fine. But when i run mvn:gwt-run, C-1.0-SNAPSHOT.jar is copied into WEB-INF/lib so i have 2 jars C-1.0-SNAPSHOT.jar and C-1.0-20110922.172721-52.jar.


The only thing I can suggest you is to try to debug maven-gwt-plugin.

Checkout it from git repository https://github.com/gwt-maven-plugin/gwt-maven-plugin.git


I had exactly the same problem. After debugging, I removed the use of maven-war-plugin and added maven-resources-plugin (compile phase, copy-resources goal). I tried gwt:run and install after that, worked without any problems. This way, we avoid the dependencies getting copied twice.

0

精彩评论

暂无评论...
验证码 换一张
取 消