Transform GWT tools SVN in a Maven dependency

75 views
Skip to first unread message

Cristiano

unread,
Oct 14, 2015, 3:01:42 AM10/14/15
to GWT Contributors
Hello All,

I'm playing with the src of GWT in these days to try out some hack, using Maven,
and while doing this I needed the GWT-Tools dependencies.

I've searched the dependencies in Maven Central Repo: http://search.maven.org/
but because some jar is rebased with JarJar, I've used maven-shade-plugin to rebase in the same way the dependencies I needed.

So, I came out with a "PoC" that proves it is possible to build (a subset of) GWT-Dev using dependencies based and rebased on maven.


As the actual way to manage the gwt-tools seems to be an "throw all in the bucket" approach,
with folders like Guava that includes 5 different versions:

Handwritten:gwt-tools cristcost$ ll lib/guava/:

total 0

drwxr-xr-x   7 cristcost  staff  238  2 Nov  2013 guava-10.0.1

drwxr-xr-x   5 cristcost  staff  170  2 Nov  2013 guava-15.0

drwxr-xr-x   5 cristcost  staff  170 30 Giu 09:51 guava-16.0.1

drwxr-xr-x   6 cristcost  staff  204 30 Giu 09:51 guava-18.0

drwxr-xr-x  10 cristcost  staff  340  2 Nov  2013 guava-r06



Wouldn't it make sense to define a maven project what represents the required libs and try to get rid of gwt-tools folder for the build?

In this way, retrieving the dependencies to build with ant could be done easily with the command:

mvn dependency:copy-dependencies

(and the project dependencies are downloaded into target/dependecies)


In a new message I'll share a synthesis with significant excerpt of pom.xml configuration required to make the PoC to work.

Cristiano



Cristiano

unread,
Oct 14, 2015, 3:02:16 AM10/14/15
to GWT Contributors

I have created 2 maven projects:
1. gwt-tools-rebased
2. gwt-tools

The first project declares these dependencies:

<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>com.google.javascript</groupId>
<artifactId>closure-compiler</artifactId>
<version>v20150901</version>
</dependency>
</dependencies>

and rebases them with maven-shade-plugin: 

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-shade-plugin</artifactId>
  <version>2.4.1</version>
  <executions>
    <execution>
      <phase>package</phase>
      <goals>
        <goal>shade</goal>
      </goals>
      <configuration>
        <relocations>
          <relocation>
            <pattern>com.google.javascript.jscomp</pattern>
            <shadedPattern>com.google.gwt.thirdparty.javascript.jscomp</shadedPattern>
          </relocation>
          <relocation>
            <pattern>com.google.javascript.rhino</pattern>
            <shadedPattern>com.google.gwt.thirdparty.javascript.rhino</shadedPattern>
          </relocation>               
          <relocation>
            <pattern>com.google.debugging.sourcemap</pattern>
            <shadedPattern>com.google.gwt.thirdparty.debugging.sourcemap</shadedPattern>
          </relocation>
          <relocation>
            <pattern>com.google.common</pattern>
            <shadedPattern>com.google.gwt.thirdparty.guava.common</shadedPattern>
          </relocation>
        </relocations>
      </configuration>
    </execution>
  </executions>
</plugin>

The second project declares these dependencies:
<dependencies>
<dependency>
<groupId>net.cristcost</groupId>
<artifactId>gwt-tools-rebased</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>colt</groupId>
<artifactId>colt</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
<version>3.11.0.v20150520-2033</version>
</dependency>
</dependencies>

The execution of the mvn dependency:copy-dependencies command has this console output:

Handwritten:gwt-tools cristcost$ mvn dependency:copy-dependencies
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building GWT Tools as Maven dependencies test 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:copy-dependencies (default-cli) @ gwt-tools ---
[INFO] Copying concurrent-1.3.4.jar to /Users/cristcost/dev/cristcost/test/gwt-tools/target/dependency/concurrent-1.3.4.jar
[INFO] Copying asm-5.0.3.jar to /Users/cristcost/dev/cristcost/test/gwt-tools/target/dependency/asm-5.0.3.jar
[INFO] Copying org.eclipse.jdt.core-3.11.0.v20150520-2033.jar to /Users/cristcost/dev/cristcost/test/gwt-tools/target/dependency/org.eclipse.jdt.core-3.11.0.v20150520-2033.jar
[INFO] Copying colt-1.2.0.jar to /Users/cristcost/dev/cristcost/test/gwt-tools/target/dependency/colt-1.2.0.jar
[INFO] Copying gwt-tools-rebased-1.0.0-SNAPSHOT.jar to /Users/cristcost/dev/cristcost/test/gwt-tools/target/dependency/gwt-tools-rebased-1.0.0-SNAPSHOT.jar
[INFO] Copying xercesImpl-2.11.0.jar to /Users/cristcost/dev/cristcost/test/gwt-tools/target/dependency/xercesImpl-2.11.0.jar
[INFO] Copying xml-apis-1.4.01.jar to /Users/cristcost/dev/cristcost/test/gwt-tools/target/dependency/xml-apis-1.4.01.jar
[INFO] Copying ant-1.7.1.jar to /Users/cristcost/dev/cristcost/test/gwt-tools/target/dependency/ant-1.7.1.jar
[INFO] Copying ant-launcher-1.7.1.jar to /Users/cristcost/dev/cristcost/test/gwt-tools/target/dependency/ant-launcher-1.7.1.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.119 s
[INFO] Finished at: 2015-10-14T08:42:18+02:00
[INFO] Final Memory: 16M/309M
[INFO] ------------------------------------------------------------------------

and produces this contents:

Handwritten:gwt-tools cristcost$ ll target/dependency/
total 31552
-rw-r--r--  1 cristcost  staff  1323005 14 Ott 08:42 ant-1.7.1.jar
-rw-r--r--  1 cristcost  staff    12143 14 Ott 08:42 ant-launcher-1.7.1.jar
-rw-r--r--  1 cristcost  staff    53231 14 Ott 08:42 asm-5.0.3.jar
-rw-r--r--  1 cristcost  staff   581945 14 Ott 08:42 colt-1.2.0.jar
-rw-r--r--  1 cristcost  staff   189284 14 Ott 08:42 concurrent-1.3.4.jar
-rw-r--r--  1 cristcost  staff  6678108 14 Ott 08:42 gwt-tools-rebased-1.0.0-SNAPSHOT.jar
-rw-r--r--  1 cristcost  staff  5716475 14 Ott 08:42 org.eclipse.jdt.core-3.11.0.v20150520-2033.jar
-rw-r--r--  1 cristcost  staff  1367760 14 Ott 08:42 xercesImpl-2.11.0.jar
-rw-r--r--  1 cristcost  staff   220536 14 Ott 08:42 xml-apis-1.4.01.jar
Handwritten:gwt-tools cristcost$ 


I hope this is inspiring and helpful 
Cristiano


Reply all
Reply to author
Forward
0 new messages