Maven puzzle

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Maven puzzle

Tobias Pietzsch
Hi,

maybe one of the maven experts can shed some light on the following behaviour…

I want to set source compatibility to 1.7.
I tried to do this by specifying
<properties>
<scijava.jvm.version>1.7</scijava.jvm.version>
</properties>
Strangely, this alone does not solve the problem. mvn on the command line says:
...
INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/pietzsch/workspace/BigDataViewer/bigdataviewer-server/src/main/java/bdv/server/BigDataServer.java:[248,46] multi-catch statement is not supported in -source 1.5
  (use -source 7 or higher to enable multi-catch statement)

I can fix it by additionally putting this snippet:
  <build>
<plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
        </plugin>
</plugins>
</build>
into the pom file.
However, shouldn’t this be already automatically done by setting scijava.jvm.version=1.7???
At least Eclipse seems to think so: I fact, the above snippet to configure maven-compiler-plugin I just copied from the “Effective POM” shown in Eclipse (for the pom without explicitly having the snippet of course…)

Does anyone have an explanation? Is this a maven bug?

all the best,
Tobias

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Maven puzzle

Curtis Rueden
Hi Tobi,

> [ERROR]
> /Users/pietzsch/workspace/BigDataViewer/bigdataviewer-server/src/main/java/bdv/server/BigDataServer.java:[248,46]
> multi-catch statement is not supported in -source 1.5
>
However, shouldn’t this be already automatically done by setting scijava.jvm.version=1.7???

Whoa, strange. Especially since it says *1.5*, which is the Maven default...

Furthermore, I cannot reproduce this problem on my system. Building with Java 6, Java 7 or Java 8 (with JAVA_HOME set accordingly), and with only the scijava.jvm.version set to 1.7, I am able to build the project successfully.

I pushed some changes to master, so that we can see whether Jenkins has a problem with it.

Regards,
Curtis

On Wed, Feb 11, 2015 at 9:58 AM, Tobias Pietzsch <[hidden email]> wrote:
Hi,

maybe one of the maven experts can shed some light on the following behaviour…

I want to set source compatibility to 1.7.
I tried to do this by specifying
<properties>
<scijava.jvm.version>1.7</scijava.jvm.version>
</properties>
Strangely, this alone does not solve the problem. mvn on the command line says:
...
INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/pietzsch/workspace/BigDataViewer/bigdataviewer-server/src/main/java/bdv/server/BigDataServer.java:[248,46] multi-catch statement is not supported in -source 1.5
  (use -source 7 or higher to enable multi-catch statement)

I can fix it by additionally putting this snippet:
  <build>
<plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
        </plugin>
</plugins>
</build>
into the pom file.
However, shouldn’t this be already automatically done by setting scijava.jvm.version=1.7???
At least Eclipse seems to think so: I fact, the above snippet to configure maven-compiler-plugin I just copied from the “Effective POM” shown in Eclipse (for the pom without explicitly having the snippet of course…)

Does anyone have an explanation? Is this a maven bug?

all the best,
Tobias

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel



_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel
Reply | Threaded
Open this post in threaded view
|

Re: Maven puzzle

Tobias Pietzsch
Hi Curtis 

On 11 Feb 2015, at 17:45, Curtis Rueden <[hidden email]> wrote:

Hi Tobi,

> [ERROR]
> /Users/pietzsch/workspace/BigDataViewer/bigdataviewer-server/src/main/java/bdv/server/BigDataServer.java:[248,46]
> multi-catch statement is not supported in -source 1.5
>
However, shouldn’t this be already automatically done by setting scijava.jvm.version=1.7???

Whoa, strange. Especially since it says *1.5*, which is the Maven default...

Furthermore, I cannot reproduce this problem on my system. Building with Java 6, Java 7 or Java 8 (with JAVA_HOME set accordingly), and with only the scijava.jvm.version set to 1.7, I am able to build the project successfully.

I pushed some changes to master, so that we can see whether Jenkins has a problem with it.

It turns out, that Jenkins has a problem with it:
has the error I reported earlier.
Adding int the maven-compiler-plugin snippet fixed it.
Probably there was no code to trigger the behaviour on master before.

all the best,
Tobias


Regards,
Curtis

On Wed, Feb 11, 2015 at 9:58 AM, Tobias Pietzsch <[hidden email]> wrote:
Hi,

maybe one of the maven experts can shed some light on the following behaviour…

I want to set source compatibility to 1.7.
I tried to do this by specifying
<properties>
<scijava.jvm.version>1.7</scijava.jvm.version>
</properties>
Strangely, this alone does not solve the problem. mvn on the command line says:
...
INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/pietzsch/workspace/BigDataViewer/bigdataviewer-server/src/main/java/bdv/server/BigDataServer.java:[248,46] multi-catch statement is not supported in -source 1.5
  (use -source 7 or higher to enable multi-catch statement)

I can fix it by additionally putting this snippet:
  <build>
<plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
        </plugin>
</plugins>
</build>
into the pom file.
However, shouldn’t this be already automatically done by setting scijava.jvm.version=1.7???
At least Eclipse seems to think so: I fact, the above snippet to configure maven-compiler-plugin I just copied from the “Effective POM” shown in Eclipse (for the pom without explicitly having the snippet of course…)

Does anyone have an explanation? Is this a maven bug?

all the best,
Tobias

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel

signature.asc (465 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Maven puzzle

Curtis Rueden
Hi Tobi,

It turns out, that Jenkins has a problem with it

I see: I could not reproduce because the new "try/catch with resources" code was not yet on the master branch.

I share your surprise that somehow overriding the scijava.jvm.version property is not enough. I have run into similar subtle issues with property overrides for dependency versions, but more recently was unable to reproduce them. It probably has something to do with how the POMs are resolved, and would be worth our time to understand better so that we avoid similar issues in the future.

Regards,
Curtis

On Fri, Feb 13, 2015 at 9:26 AM, Tobias Pietzsch <[hidden email]> wrote:
Hi Curtis 

On 11 Feb 2015, at 17:45, Curtis Rueden <[hidden email]> wrote:

Hi Tobi,

> [ERROR]
> /Users/pietzsch/workspace/BigDataViewer/bigdataviewer-server/src/main/java/bdv/server/BigDataServer.java:[248,46]
> multi-catch statement is not supported in -source 1.5
>
However, shouldn’t this be already automatically done by setting scijava.jvm.version=1.7???

Whoa, strange. Especially since it says *1.5*, which is the Maven default...

Furthermore, I cannot reproduce this problem on my system. Building with Java 6, Java 7 or Java 8 (with JAVA_HOME set accordingly), and with only the scijava.jvm.version set to 1.7, I am able to build the project successfully.

I pushed some changes to master, so that we can see whether Jenkins has a problem with it.

It turns out, that Jenkins has a problem with it:
has the error I reported earlier.
Adding int the maven-compiler-plugin snippet fixed it.
Probably there was no code to trigger the behaviour on master before.

all the best,
Tobias


Regards,
Curtis

On Wed, Feb 11, 2015 at 9:58 AM, Tobias Pietzsch <[hidden email]> wrote:
Hi,

maybe one of the maven experts can shed some light on the following behaviour…

I want to set source compatibility to 1.7.
I tried to do this by specifying
<properties>
<scijava.jvm.version>1.7</scijava.jvm.version>
</properties>
Strangely, this alone does not solve the problem. mvn on the command line says:
...
INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/pietzsch/workspace/BigDataViewer/bigdataviewer-server/src/main/java/bdv/server/BigDataServer.java:[248,46] multi-catch statement is not supported in -source 1.5
  (use -source 7 or higher to enable multi-catch statement)

I can fix it by additionally putting this snippet:
  <build>
<plugins>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <configuration>
            <source>1.7</source>
            <target>1.7</target>
          </configuration>
        </plugin>
</plugins>
</build>
into the pom file.
However, shouldn’t this be already automatically done by setting scijava.jvm.version=1.7???
At least Eclipse seems to think so: I fact, the above snippet to configure maven-compiler-plugin I just copied from the “Effective POM” shown in Eclipse (for the pom without explicitly having the snippet of course…)

Does anyone have an explanation? Is this a maven bug?

all the best,
Tobias

_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel


_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel



_______________________________________________
ImageJ-devel mailing list
[hidden email]
http://imagej.net/mailman/listinfo/imagej-devel