Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maven shade intergration #52

Open
vladimirdolzhenko opened this issue Apr 24, 2015 · 5 comments
Open

maven shade intergration #52

vladimirdolzhenko opened this issue Apr 24, 2015 · 5 comments

Comments

@vladimirdolzhenko
Copy link

Is it possible to integrate with shade maven plugin ?

like transformer class?

@luontola
Copy link
Owner

I'm using Retrolambda and Shade plugins together in https://github.com/orfjackal/jumi without any problems. First the Retrolambda plugin backports the bytecode and then the Shade plugin does its thing.

Why would you want to integrate them?

The Shade plugin's transformer API is probably too limited for Retrolambda.

@vladimirdolzhenko
Copy link
Author

I use shade plugin to make a jar with all-reasonably-required-dependencies. Some of them are java8.
After checking with javap packed class files - those classes belong to actual project are converted to java7 (target bytecode level) while some dependencies are in java8.

Maybe I configured it in a wrong way - i tried to do in the same way as you did in https://github.com/orfjackal/jumi/blob/master/parent/pom.xml - could you please provide more concrete example ?

  <plugin>
    <groupId>net.orfjackal.retrolambda</groupId>
    <artifactId>retrolambda-maven-plugin</artifactId>
    <version>2.0.2</version>
    <executions>
      <execution>
        <goals>
          <goal>process-main</goal>
          <goal>process-test</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <target>1.7</target>
      <java8home>${env.JAVA_HOME8}</java8home>
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.3</version>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <artifactSet>
            <includes>
              <include>...</include>
            </includes>
          </artifactSet>
        </configuration>
      </execution>
    </executions>
  </plugin>

@luontola
Copy link
Owner

OK. The Retrolambda plugin doesn't backport the dependencies. As a workaround you should backport each Java 8 dependency individually and publish it as a Java 7 compatible jar file.

@vladimirdolzhenko
Copy link
Author

The actual workaround is run custom shell script that runs java -jar retrolambda.jar - I suppose it would be better to backport dependencies in plugin too.

@luontola
Copy link
Owner

This might be solvable by implementing issue #44, after which Retrolambda could be used to process the JAR file which the Shade plugin generates.

However, it would be best to do the backporting inside the dependency project, so that all of the project's tests would be run against the backported classes. Otherwise there is some possibility that the project uses features which Retrolambda doesn't backport.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants