maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <org.apache.maven.u...@io7m.com>
Subject Re: Extracting classes from a separate project?
Date Tue, 01 Dec 2015 19:29:22 GMT
On 2015-12-01T17:56:15 +0000
<org.apache.maven.user@io7m.com> wrote:
> 
> On 2015-12-01T10:45:16 -0600
> Curtis Rueden <ctrueden@wisc.edu> wrote:
> > Why not just make your single-module library artifact an "uber-JAR" consisting 
> > only of its own sources plus the relocated+minimized fastutil classes, using 
> > <minimizeJar>true</minimizeJar>?
> 
> The project is actually a multi-module project, with several modules
> requiring access to the fastutil classes. My main concern is how well
> IDEs will be able to cope with this...

The answer turend out to be "very poorly", so I've gone with your
original suggestion:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <minimizeJar>true</minimizeJar>
              <artifactSet>
                <includes>
                  <include>it.unimi.dsi:fastutil</include>
                </includes>
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>it.unimi.dsi</pattern>
                  <shadedPattern>com.io7m.jcanephora.jogl.fastutil</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>

This replaces the default jar produced by the project with one that
contains only the required classes, and moves them into their own
package to prevent later conflicts. The it.unimi.dsi:fastutil artifact
is made 'optional' - I tried to use a 'provided' scope, but for some
reason this prevented the shade plugin from seeing the dependency
at all, even with the 'keepDependenciesWithProvidedScope' flag enabled.

M

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message