Maven Shading third party libraries

Discussion in 'Plugin Development' started by dark navi, Jun 17, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    dark navi

    Hey guys! I have been loading third party libraries using this method and thus far it as worked. It is a pretty ugly way of doing it, so I was wondering if anyone could write up a quick tutorial on how to use the Maven Shade plugin to compile third party libraries into your jar.

    If you need an example library, I am using C3P0.

    Edit: Hate to do this, but I know md_5 knows how.
     
  2. Offline

    wreed12345

    a late reply but dark navi i would also like this
     
  3. Offline

    dark navi

    I figured it out a while ago, so here is how I get it to work:
    In your pom.xml, add this to your <plugins> tag:
    PHP:
    <plugin>
            <
    groupId>org.apache.maven.plugins</groupId>
            <
    artifactId>maven-shade-plugin</artifactId>
            <
    version>2.1</version>
            <
    configuration>
              <!-- 
    put your configurations here -->
            </
    configuration>
            <
    executions>
              <
    execution>
                <
    phase>package</phase>
                <
    goals>
                  <
    goal>shade</goal>
                </
    goals>
              </
    execution>
            </
    executions>
          </
    plugin>
    And then change any scopes of any dependencies that you want to get shaded to 'compile' like so:
    PHP:
    <dependency>
          <
    groupId>c3p0</groupId>
          <
    artifactId>c3p0</artifactId>
          <
    version>0.9.1.2</version>
          <
    type>jar</type>
          <
    scope>compile</scope>
        </
    dependency>
     
  4. Offline

    wreed12345

    dark navi im sorry but im a complete newb to maven all together so i have no idea what your talking about :(
     
  5. Offline

    dark navi


    Have you ever compiled a project with Maven?
     
  6. Offline

    wreed12345

  7. Offline

    dark navi

    :| Try following these instructions and see if you can get Maven installed.
     
Thread Status:
Not open for further replies.

Share This Page