chrisdchristo / capsule-maven-plugin

Capsule Maven Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

For a Java 7 maven project capsule-maven 0.10.4 fails with Unsupported major.minor version 52.0

tngmech opened this issue · comments

In contrast to capsule-maven 0.10.3 a Maven project still using Java 7 fails with a message during the build that the class version is unsupported. 52.0 ist Java 8, so probably from 0.10.3 to 0.10.4 the compiler level was changed. This issue should be reproducible with a real JDK 7 installation by just flipping the versions between 0.10.3 and 0.10.4.
It would be great to have Java 7 still supported for a build.

In a submodule project the config is

      <plugin>
        <groupId>com.github.chrischristo</groupId>
        <artifactId>capsule-maven-plugin</artifactId>
        <version>0.10.4</version>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
            <configuration>
              <types>fat</types>
              <appClass>my.MainClass</appClass>
            </configuration>
          </execution>
        </executions>
      </plugin>

Tried to follow the suggestion to use Capsule 1.0-rc1. Compare: puniverse/capsule-maven#7
However there is no newer version of the maven plugin itself. According to the documentation https://github.com/chrischristo/capsule-maven-plugin (customer capsule version) this would require to set a Maven property for it to use a different Capsule.

But neither:

      <plugin>
        <groupId>com.github.chrischristo</groupId>
        <artifactId>capsule-maven-plugin</artifactId>
        <version>0.10.4</version>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
            <configuration>
             <properties>
              <capsule.version>1.0-rc1</capsule.version>
              </properties>
              <types>fat</types>
              <appClass>my.MainClass</appClass> 
            </configuration>
          </execution>
        </executions>
      </plugin>

nor

<!-- top-level properties -->
<properties>
  <capsule.version>1.0-rc1</capsule.version>
</properties>
<build>
<plugins>
      <plugin>
        <groupId>com.github.chrischristo</groupId>
        <artifactId>capsule-maven-plugin</artifactId>
        <version>0.10.4</version>
        <executions>
          <execution>
            <goals>
              <goal>build</goal>
            </goals>
            <configuration>
              <types>fat</types>
              <appClass>my.MainClass</appClass> 
            </configuration>
          </execution>
        </executions>
      </plugin>

is effective and still results in 0.10.4 (in contrast to 0.10.3) in:

INFO] --- capsule-maven-plugin:0.10.4:build (default) @ MyMavenSubModule ---
[WARNING] Error injecting: capsule.CapsuleMojo
java.lang.TypeNotPresentException: Type capsule.CapsuleMojo not present
    at org.eclipse.sisu.space.URLClassSpace.loadClass(URLClassSpace.java:115)
    at org.eclipse.sisu.space.NamedClass.load(NamedClass.java:46)
    at org.eclipse.sisu.space.AbstractDeferredClass.get(AbstractDeferredClass.java:48)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
    at org.eclipse.sisu.plexus.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:133)
...
Caused by: java.lang.UnsupportedClassVersionError: capsule/CapsuleMojo : Unsupported major.minor version 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
...
    ... 41 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Besides, obviously there's no need to configure anything as the newest capsule version is used:

[INFO] --- capsule-maven-plugin:0.10.3:build (default) @ MyModule ---
...
[INFO] [Capsule] Using Capsule Version: 1.0-rc1

So basically I just can't use capsule-maven-plugin:0.10.4 and there's nothing newer on Maven central.

ok looking into this, bare with me.

Yeah, I changed 0.10.4 to java8, I figured its been well over a year since java8 was released so thought people would have moved on to it by now, guess I was wrong. So 0.10.5 will revert back to java 7 and you shouldn't have this issue. Please use 0.10.3 of the plugin in the meantime.

And yes the plugin will always pick the latest version of capsule (which at currently is 1.0-rc1) if you don't specify the <capsule.version> property.

No problem. Got a working solution meanwhile. Already updated stone-aged Maven to use the plugin.
Unfortunately not me to decide about JDK8 ;-) Happy to have JDK7 and not EOLed JDK6 anymore ;-)

Let me know if 0.10.5 fixes your issue (reverted back to java7).

Thx, I triggered a collegue of mine due to vacation.

The version 0.10.5 runs with Java 7. We can close this issue.

Ah, that's good. Thanks.