AW: about source and target in maven-compiler-plugin

2015-03-30 Thread Sebastian Oerding
Hi Lin,

that has not been my comment but cited from the given link. However you are 
right.

In case of more questions use the given link or some Maven / Java documentation 
to get more information.

Note that from the point of view of your question the class files happen to be 
incidentally generated by Maven invoking the javac with some options. Hence the 
runtime behavior does not have to do anything with Maven but is solely a Java 
related question. Hence a Maven mailing list is no more the proper place.

With regards
Sebastian

-Ursprüngliche Nachricht-
Von: Lin Ma [mailto:lin...@gmail.com] 
Gesendet: Montag, 30. März 2015 23:50
An: Maven Users List
Betreff: Re: about source and target in maven-compiler-plugin

Hi Sebastian,

For your comments, "Merely setting the target option does not guarantee that 
your code actually runs on a JRE with the specified version", I think you mean 
the code still runs on target JRE version as specified in pom.xml, but it will 
still fail when using a new version of API on an old JRE?
Thanks.

regards,
Lin

On Mon, Mar 30, 2015 at 1:21 AM, Sebastian Oerding < 
sebastian.oerd...@robotron.de> wrote:

> As I felt unfomfortable leaving it as it is I checked
>
> http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-com
> piler-source-and-target.html where there was the following hint on the 
> target tag:
> Note: Merely setting the target option does not guarantee that your 
> code actually runs on a JRE with the specified version. The pitfall is 
> unintended usage of APIs that only exist in later JREs which would 
> make your code fail at runtime with a linkage error. To avoid this 
> issue, you can either configure the compiler's boot classpath to match 
> the target JRE or use the Animal Sniffer Maven Plugin to verify your 
> code doesn't use unintended APIs.
>
> With regards
> Sebastian
>
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:56
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Thanks all the same Sebastian. Your reply is very helpful and bring us 
> further thoughts.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:47 AM, Sebastian Oerding < 
> sebastian.oerd...@robotron.de> wrote:
>
> > Hi Lin,
> >
> > I just tried my example and Maxim is right. I thought that the 
> > source should take the API compatibility into account it seems that 
> > it is not this way. Hence if the classes are successfully compiled 
> > (which requires a JDK >
> > 1.5) and you are executing them with Java 1.5 the StringBuilder 
> > class will not be in place -> ClassNotFoundException (the class 
> > format should be as needed for Java 1.5 due to the target).
> >
> > However I will not tell anymore about it as I'm not completely sure 
> > about the moment and I do not have the time to really dig into this.
> Sorry.
> > Detailed information about this is available in the net. In an 
> > earlier email someone already provided links for the Maven documentation.
> >
> > Furthermore details about setting the compiler level can be found 
> > for example in the Sun Certified Java Programmer Study Guide.
> >
> > With regards
> > Sebastian
> >
> > -Ursprüngliche Nachricht-
> > Von: Lin Ma [mailto:lin...@gmail.com]
> > Gesendet: Montag, 30. März 2015 09:38
> > An: Maven Users List
> > Betreff: Re: about source and target in maven-compiler-plugin
> >
> > Hi Maxim,
> >
> > Why compiler will not fail? Supposing StringBuilder is a class in 
> > JDK 1.6, but we force compiler to use 1.5 which has no such class? 
> > Please feel free to correct me if I am wrong.
> >
> > regards,
> > Lin
> >
> > On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik 
> > 
> > wrote:
> >
> > > If I'm not mistaken compiler will not fail in this case BUT the 
> > > application will fail in runtime (in case Java 1.5 is used) due to 
> > > StringBuilder class is missing in JDK
> > >
> > > On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
> > >
> > > > Thanks Sebastian,
> > > >
> > > > 1. I am using JDK 1.7/1.8 for both development and deployment in 
> > > > runtime, shall I change 1.5 of source and target to 1.7/1.8?
> > > >
> > > > 2. In your example, "for example you can write source code using 
> > > > a JDK
> > > 1.6
> > > > which is compliant to Java 1.5. However you can also use the
> > > StringBuilder
> > > > class which does not exist in Java 1.5", I think using JDK 1.6 
> > > > specific feature but using 1.5 complier will fail? No? Please 
> > > > feel free to correct me.
> > > >
> > > > regards,
> > > > Lin
> > > >
> > > > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding < 
> > > > sebastian.oerd...@robotron.de> wrote:
> > > >
> > > > > source -> The level (JDK version) to which the source code 
> > > > > must be compliant to, for example you can write source code 
> > > > > using a JDK
> > > > > 1.6
> > > which
> > > > > is compliant to Java 1.5. However you can also use the 
> 

AW: about source and target in maven-compiler-plugin

2015-03-30 Thread Sebastian Oerding
The compiling fails when using Maven with a JDK 1.6 and 'source' and 'target' 
set to 1.3.
The syntax for assertions has been added in Java 1.4, for example check the Sun 
Certified Java Programmer Java 6 Study Guide.

There should also be basic / sufficient information available in the Oracle 
Java Tutorials.

Using source / target 1.5 the compilation works. However using a JDK 1.5 the 
program must fail at runtime due to a missing StringBuilder class (in fact you 
are likely to see a ClassNotFoundException). However the JDKs do understand 
class file format of lower versions. Hence the program will run as expected if 
having it compiled with source / target 1.5 and above AND using a JDK 1.6 or 
above.

This question becomes completely independent from Maven. Hence further 
questions about this should be requested to some Java specific forums / mailing 
lists, not Maven mailing lists.

I got the impression that you are a Maven / Java starter. Maybe you should ask 
a colleague / someone you know for more explanations on this. Probably some 
pair programming trying this stuff would be more effective.

With regards
Sebastian

-Ursprüngliche Nachricht-
Von: Lin Ma [mailto:lin...@gmail.com] 
Gesendet: Montag, 30. März 2015 23:43
An: Maven Users List
Betreff: Re: about source and target in maven-compiler-plugin

Hi Sebastian,

The sample is interesting. In your sample, you are using source 1.5 in pom.xml? 
Thanks.

regards,
Lin

On Mon, Mar 30, 2015 at 1:27 AM, Sebastian Oerding < 
sebastian.oerd...@robotron.de> wrote:

> Finally to finish this I tried a mini maven project containing the 
> following class:
>
> package Test;
>
> public class Test {
> public void foo() {
> System.out.println(new StringBuilder("Hello world!"));
> assert true;
> }
> }
>
> Running mvn install gave me (stripped for the relevant part):
>
> [INFO]
> [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ 
> Test --- [WARNING] Using platform encoding (Cp1252 actually) to 
> copy filtered resources, i.e. build is platform dependent!
> [INFO] skip non existing resourceDirectory 
> C:\Users\sebastian.oerding\workspaces\workspace\Test\src\main\reso
> urces
> [INFO]
> [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ 
> Test
> ---
> [INFO] Changes detected - recompiling the module!
> [WARNING] File encoding has not been set, using platform encoding 
> Cp1252, i.e. build is platform dependent!
> [INFO] Compiling 1 source file to
> C:\Users\sebastian.oerding\workspaces\workspace\Test\target\classe
> s [INFO] -
> [ERROR] COMPILATION ERROR :
> [INFO] -
> [ERROR]
> /C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/jav
> a/Test/Test.java:[6,17]
> C:\Users\sebastian.o
> \Test.java:6: not a statement
> [ERROR]
> /C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/jav
> a/Test/Test.java:[6,23]
> C:\Users\sebastian.o
> \Test.java:6: ';' expected
> [INFO] 2 errors
> [INFO] -
> [INFO]
> --
> --
> [INFO] BUILD FAILURE
> [INFO]
> --
> --
> [INFO] Total time: 1.138 s
> [INFO] Finished at: 2015-03-30T10:23:21+02:00 [INFO] Final Memory: 
> 9M/152M [INFO]
> --
> --
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
> (default-compile) on project Tes
> [ERROR]
> /C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/jav
> a/Test/Test.java:[6,17]
> C:\Users\sebastian.o
> \Test.java:6: not a statement
> [ERROR]
> /C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/jav
> a/Test/Test.java:[6,23]
> C:\Users\sebastian.o
> \Test.java:6: ';' expected
> [ERROR] -> [Help 1]
>
> Hence new available API may be a special case but using features such 
> as assertions not supported does really cause a compiler error (the 
> maven installation used as JDK 1.6)
>
> With regards
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:56
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Thanks all the same Sebastian. Your reply is very helpful and bring us 
> further thoughts.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:47 AM, Sebastian Oerding < 
> sebastian.oerd...@robotron.de> wrote:
>
> > Hi Lin,
> >
> > I just tried my example and Maxim is right. I thought that the 
> > source should take the API compatibility into account it seems that 
> > it is not this way. Hence if the classes are successfully compiled 
> > (which requires a JDK >
> > 1.5) and you are e

AW: about source and target in maven-compiler-plugin

2015-03-30 Thread Sebastian Oerding
The file with the name pom.xml which is informally called super pom is part of 
your Maven installation.

If you have more questions about basic Maven stuff you should ask some 
colleagues or use a search engine.
For example using Google and typing 'maven super pom‘ the auto-completion even 
suggested 'maven super pom location'.

To get a better knowledge of Maven again use a search engine in case of 
specific questions. To get a basic understanding get the manual, I think a few 
years ago it has been necessary to register at sonatype for that.

With regards
Sebastian

-Ursprüngliche Nachricht-
Von: Lin Ma [mailto:lin...@gmail.com] 
Gesendet: Montag, 30. März 2015 23:40
An: Maven Users List
Betreff: Re: about source and target in maven-compiler-plugin

Thanks Sebastian,

Where to find the super pom.xml?

regards,
Lin

On Mon, Mar 30, 2015 at 1:18 AM, Sebastian Oerding < 
sebastian.oerd...@robotron.de> wrote:

> pom.xml uses inheritance. There is a so called 'super POM' provided 
> with the maven installation from which all entries are inherited if 
> not added / overwritten by you.
>
> Newer versions of Maven have Java 1.6 as default.
>
> With regards
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:56
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Thanks all the same Sebastian. Your reply is very helpful and bring us 
> further thoughts.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:47 AM, Sebastian Oerding < 
> sebastian.oerd...@robotron.de> wrote:
>
> > Hi Lin,
> >
> > I just tried my example and Maxim is right. I thought that the 
> > source should take the API compatibility into account it seems that 
> > it is not this way. Hence if the classes are successfully compiled 
> > (which requires a JDK >
> > 1.5) and you are executing them with Java 1.5 the StringBuilder 
> > class will not be in place -> ClassNotFoundException (the class 
> > format should be as needed for Java 1.5 due to the target).
> >
> > However I will not tell anymore about it as I'm not completely sure 
> > about the moment and I do not have the time to really dig into this.
> Sorry.
> > Detailed information about this is available in the net. In an 
> > earlier email someone already provided links for the Maven documentation.
> >
> > Furthermore details about setting the compiler level can be found 
> > for example in the Sun Certified Java Programmer Study Guide.
> >
> > With regards
> > Sebastian
> >
> > -Ursprüngliche Nachricht-
> > Von: Lin Ma [mailto:lin...@gmail.com]
> > Gesendet: Montag, 30. März 2015 09:38
> > An: Maven Users List
> > Betreff: Re: about source and target in maven-compiler-plugin
> >
> > Hi Maxim,
> >
> > Why compiler will not fail? Supposing StringBuilder is a class in 
> > JDK 1.6, but we force compiler to use 1.5 which has no such class? 
> > Please feel free to correct me if I am wrong.
> >
> > regards,
> > Lin
> >
> > On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik 
> > 
> > wrote:
> >
> > > If I'm not mistaken compiler will not fail in this case BUT the 
> > > application will fail in runtime (in case Java 1.5 is used) due to 
> > > StringBuilder class is missing in JDK
> > >
> > > On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
> > >
> > > > Thanks Sebastian,
> > > >
> > > > 1. I am using JDK 1.7/1.8 for both development and deployment in 
> > > > runtime, shall I change 1.5 of source and target to 1.7/1.8?
> > > >
> > > > 2. In your example, "for example you can write source code using 
> > > > a JDK
> > > 1.6
> > > > which is compliant to Java 1.5. However you can also use the
> > > StringBuilder
> > > > class which does not exist in Java 1.5", I think using JDK 1.6 
> > > > specific feature but using 1.5 complier will fail? No? Please 
> > > > feel free to correct me.
> > > >
> > > > regards,
> > > > Lin
> > > >
> > > > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding < 
> > > > sebastian.oerd...@robotron.de> wrote:
> > > >
> > > > > source -> The level (JDK version) to which the source code 
> > > > > must be compliant to, for example you can write source code 
> > > > > using a JDK
> > > > > 1.6
> > > which
> > > > > is compliant to Java 1.5. However you can also use the 
> > > > > StringBuilder
> > > > class
> > > > > which does not exist in Java 1.5 target -> The class version 
> > > > > of the generated class files. The class
> > > > format
> > > > > changes with some Java version, for example as some stuff may 
> > > > > be added
> > > > for
> > > > > performance reason. For example if a new byte code instruction 
> > > > > comes up (like 'invokedynamic') this really makes a change. Or 
> > > > > another example
> > > > (I'm
> > > > > not really sure about it): As far as I think a stack map has 
> > > > > been added from Java 5 to Java 1.6. This should improve 
> > > > > performance and makes
> > > subtle
> > > > > differences when ClassNotFoundE

Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Lin Ma
Hi Sebastian,

For your comments, "Merely setting the target option does not guarantee
that your code actually runs on a JRE with the specified version", I think
you mean the code still runs on target JRE version as specified in pom.xml,
but it will still fail when using a new version of API on an old JRE?
Thanks.

regards,
Lin

On Mon, Mar 30, 2015 at 1:21 AM, Sebastian Oerding <
sebastian.oerd...@robotron.de> wrote:

> As I felt unfomfortable leaving it as it is I checked
>
> http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
> where there was the following hint on the target tag:
> Note: Merely setting the target option does not guarantee that your code
> actually runs on a JRE with the specified version. The pitfall is
> unintended usage of APIs that only exist in later JREs which would make
> your code fail at runtime with a linkage error. To avoid this issue, you
> can either configure the compiler's boot classpath to match the target JRE
> or use the Animal Sniffer Maven Plugin to verify your code doesn't use
> unintended APIs.
>
> With regards
> Sebastian
>
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:56
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Thanks all the same Sebastian. Your reply is very helpful and bring us
> further thoughts.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:47 AM, Sebastian Oerding <
> sebastian.oerd...@robotron.de> wrote:
>
> > Hi Lin,
> >
> > I just tried my example and Maxim is right. I thought that the source
> > should take the API compatibility into account it seems that it is not
> > this way. Hence if the classes are successfully compiled (which
> > requires a JDK >
> > 1.5) and you are executing them with Java 1.5 the StringBuilder class
> > will not be in place -> ClassNotFoundException (the class format
> > should be as needed for Java 1.5 due to the target).
> >
> > However I will not tell anymore about it as I'm not completely sure
> > about the moment and I do not have the time to really dig into this.
> Sorry.
> > Detailed information about this is available in the net. In an earlier
> > email someone already provided links for the Maven documentation.
> >
> > Furthermore details about setting the compiler level can be found for
> > example in the Sun Certified Java Programmer Study Guide.
> >
> > With regards
> > Sebastian
> >
> > -Ursprüngliche Nachricht-
> > Von: Lin Ma [mailto:lin...@gmail.com]
> > Gesendet: Montag, 30. März 2015 09:38
> > An: Maven Users List
> > Betreff: Re: about source and target in maven-compiler-plugin
> >
> > Hi Maxim,
> >
> > Why compiler will not fail? Supposing StringBuilder is a class in JDK
> > 1.6, but we force compiler to use 1.5 which has no such class? Please
> > feel free to correct me if I am wrong.
> >
> > regards,
> > Lin
> >
> > On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik
> > 
> > wrote:
> >
> > > If I'm not mistaken compiler will not fail in this case BUT the
> > > application will fail in runtime (in case Java 1.5 is used) due to
> > > StringBuilder class is missing in JDK
> > >
> > > On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
> > >
> > > > Thanks Sebastian,
> > > >
> > > > 1. I am using JDK 1.7/1.8 for both development and deployment in
> > > > runtime, shall I change 1.5 of source and target to 1.7/1.8?
> > > >
> > > > 2. In your example, "for example you can write source code using a
> > > > JDK
> > > 1.6
> > > > which is compliant to Java 1.5. However you can also use the
> > > StringBuilder
> > > > class which does not exist in Java 1.5", I think using JDK 1.6
> > > > specific feature but using 1.5 complier will fail? No? Please feel
> > > > free to correct me.
> > > >
> > > > regards,
> > > > Lin
> > > >
> > > > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding <
> > > > sebastian.oerd...@robotron.de> wrote:
> > > >
> > > > > source -> The level (JDK version) to which the source code must
> > > > > be compliant to, for example you can write source code using a
> > > > > JDK
> > > > > 1.6
> > > which
> > > > > is compliant to Java 1.5. However you can also use the
> > > > > StringBuilder
> > > > class
> > > > > which does not exist in Java 1.5 target -> The class version of
> > > > > the generated class files. The class
> > > > format
> > > > > changes with some Java version, for example as some stuff may be
> > > > > added
> > > > for
> > > > > performance reason. For example if a new byte code instruction
> > > > > comes up (like 'invokedynamic') this really makes a change. Or
> > > > > another example
> > > > (I'm
> > > > > not really sure about it): As far as I think a stack map has
> > > > > been added from Java 5 to Java 1.6. This should improve
> > > > > performance and makes
> > > subtle
> > > > > differences when ClassNotFoundException are thrown. You can use
> > > > > a JDK
> > > to
> > > > > compile code for diff

Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Lin Ma
Hi Sebastian,

The sample is interesting. In your sample, you are using source 1.5 in
pom.xml? Thanks.

regards,
Lin

On Mon, Mar 30, 2015 at 1:27 AM, Sebastian Oerding <
sebastian.oerd...@robotron.de> wrote:

> Finally to finish this I tried a mini maven project containing the
> following class:
>
> package Test;
>
> public class Test {
> public void foo() {
> System.out.println(new StringBuilder("Hello world!"));
> assert true;
> }
> }
>
> Running mvn install gave me (stripped for the relevant part):
>
> [INFO]
> [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @
> Test ---
> [WARNING] Using platform encoding (Cp1252 actually) to copy filtered
> resources, i.e. build is platform dependent!
> [INFO] skip non existing resourceDirectory
> C:\Users\sebastian.oerding\workspaces\workspace\Test\src\main\resources
> [INFO]
> [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Test
> ---
> [INFO] Changes detected - recompiling the module!
> [WARNING] File encoding has not been set, using platform encoding Cp1252,
> i.e. build is platform dependent!
> [INFO] Compiling 1 source file to
> C:\Users\sebastian.oerding\workspaces\workspace\Test\target\classes
> [INFO] -
> [ERROR] COMPILATION ERROR :
> [INFO] -
> [ERROR]
> /C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/java/Test/Test.java:[6,17]
> C:\Users\sebastian.o
> \Test.java:6: not a statement
> [ERROR]
> /C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/java/Test/Test.java:[6,23]
> C:\Users\sebastian.o
> \Test.java:6: ';' expected
> [INFO] 2 errors
> [INFO] -
> [INFO]
> 
> [INFO] BUILD FAILURE
> [INFO]
> 
> [INFO] Total time: 1.138 s
> [INFO] Finished at: 2015-03-30T10:23:21+02:00
> [INFO] Final Memory: 9M/152M
> [INFO]
> 
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
> (default-compile) on project Tes
> [ERROR]
> /C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/java/Test/Test.java:[6,17]
> C:\Users\sebastian.o
> \Test.java:6: not a statement
> [ERROR]
> /C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/java/Test/Test.java:[6,23]
> C:\Users\sebastian.o
> \Test.java:6: ';' expected
> [ERROR] -> [Help 1]
>
> Hence new available API may be a special case but using features such as
> assertions not supported does really cause a compiler error (the maven
> installation used as JDK 1.6)
>
> With regards
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:56
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Thanks all the same Sebastian. Your reply is very helpful and bring us
> further thoughts.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:47 AM, Sebastian Oerding <
> sebastian.oerd...@robotron.de> wrote:
>
> > Hi Lin,
> >
> > I just tried my example and Maxim is right. I thought that the source
> > should take the API compatibility into account it seems that it is not
> > this way. Hence if the classes are successfully compiled (which
> > requires a JDK >
> > 1.5) and you are executing them with Java 1.5 the StringBuilder class
> > will not be in place -> ClassNotFoundException (the class format
> > should be as needed for Java 1.5 due to the target).
> >
> > However I will not tell anymore about it as I'm not completely sure
> > about the moment and I do not have the time to really dig into this.
> Sorry.
> > Detailed information about this is available in the net. In an earlier
> > email someone already provided links for the Maven documentation.
> >
> > Furthermore details about setting the compiler level can be found for
> > example in the Sun Certified Java Programmer Study Guide.
> >
> > With regards
> > Sebastian
> >
> > -Ursprüngliche Nachricht-
> > Von: Lin Ma [mailto:lin...@gmail.com]
> > Gesendet: Montag, 30. März 2015 09:38
> > An: Maven Users List
> > Betreff: Re: about source and target in maven-compiler-plugin
> >
> > Hi Maxim,
> >
> > Why compiler will not fail? Supposing StringBuilder is a class in JDK
> > 1.6, but we force compiler to use 1.5 which has no such class? Please
> > feel free to correct me if I am wrong.
> >
> > regards,
> > Lin
> >
> > On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik
> > 
> > wrote:
> >
> > > If I'm not mistaken compiler will not fail in this case BUT the
> > > application will fail in runtime (in case Java 1.5 is used) due to
> > > StringBuilder class is missing in JDK

Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Lin Ma
Thanks Sebastian,

Where to find the super pom.xml?

regards,
Lin

On Mon, Mar 30, 2015 at 1:18 AM, Sebastian Oerding <
sebastian.oerd...@robotron.de> wrote:

> pom.xml uses inheritance. There is a so called 'super POM' provided with
> the maven installation from which all entries are inherited if not added /
> overwritten by you.
>
> Newer versions of Maven have Java 1.6 as default.
>
> With regards
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:56
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Thanks all the same Sebastian. Your reply is very helpful and bring us
> further thoughts.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:47 AM, Sebastian Oerding <
> sebastian.oerd...@robotron.de> wrote:
>
> > Hi Lin,
> >
> > I just tried my example and Maxim is right. I thought that the source
> > should take the API compatibility into account it seems that it is not
> > this way. Hence if the classes are successfully compiled (which
> > requires a JDK >
> > 1.5) and you are executing them with Java 1.5 the StringBuilder class
> > will not be in place -> ClassNotFoundException (the class format
> > should be as needed for Java 1.5 due to the target).
> >
> > However I will not tell anymore about it as I'm not completely sure
> > about the moment and I do not have the time to really dig into this.
> Sorry.
> > Detailed information about this is available in the net. In an earlier
> > email someone already provided links for the Maven documentation.
> >
> > Furthermore details about setting the compiler level can be found for
> > example in the Sun Certified Java Programmer Study Guide.
> >
> > With regards
> > Sebastian
> >
> > -Ursprüngliche Nachricht-
> > Von: Lin Ma [mailto:lin...@gmail.com]
> > Gesendet: Montag, 30. März 2015 09:38
> > An: Maven Users List
> > Betreff: Re: about source and target in maven-compiler-plugin
> >
> > Hi Maxim,
> >
> > Why compiler will not fail? Supposing StringBuilder is a class in JDK
> > 1.6, but we force compiler to use 1.5 which has no such class? Please
> > feel free to correct me if I am wrong.
> >
> > regards,
> > Lin
> >
> > On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik
> > 
> > wrote:
> >
> > > If I'm not mistaken compiler will not fail in this case BUT the
> > > application will fail in runtime (in case Java 1.5 is used) due to
> > > StringBuilder class is missing in JDK
> > >
> > > On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
> > >
> > > > Thanks Sebastian,
> > > >
> > > > 1. I am using JDK 1.7/1.8 for both development and deployment in
> > > > runtime, shall I change 1.5 of source and target to 1.7/1.8?
> > > >
> > > > 2. In your example, "for example you can write source code using a
> > > > JDK
> > > 1.6
> > > > which is compliant to Java 1.5. However you can also use the
> > > StringBuilder
> > > > class which does not exist in Java 1.5", I think using JDK 1.6
> > > > specific feature but using 1.5 complier will fail? No? Please feel
> > > > free to correct me.
> > > >
> > > > regards,
> > > > Lin
> > > >
> > > > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding <
> > > > sebastian.oerd...@robotron.de> wrote:
> > > >
> > > > > source -> The level (JDK version) to which the source code must
> > > > > be compliant to, for example you can write source code using a
> > > > > JDK
> > > > > 1.6
> > > which
> > > > > is compliant to Java 1.5. However you can also use the
> > > > > StringBuilder
> > > > class
> > > > > which does not exist in Java 1.5 target -> The class version of
> > > > > the generated class files. The class
> > > > format
> > > > > changes with some Java version, for example as some stuff may be
> > > > > added
> > > > for
> > > > > performance reason. For example if a new byte code instruction
> > > > > comes up (like 'invokedynamic') this really makes a change. Or
> > > > > another example
> > > > (I'm
> > > > > not really sure about it): As far as I think a stack map has
> > > > > been added from Java 5 to Java 1.6. This should improve
> > > > > performance and makes
> > > subtle
> > > > > differences when ClassNotFoundException are thrown. You can use
> > > > > a JDK
> > > to
> > > > > compile code for different but lower versions. This way can
> > > > > benefit
> > > from
> > > > > some optimizations which weren't available with the old JDK and
> > > > > are compatible.
> > > > >
> > > > > With regards
> > > > > Sebastian
> > > > >
> > > > > -Ursprüngliche Nachricht-
> > > > > Von: Lin Ma [mailto:lin...@gmail.com]
> > > > > Gesendet: Montag, 30. März 2015 07:46
> > > > > An: Maven Users List
> > > > > Betreff: about source and target in maven-compiler-plugin
> > > > >
> > > > > Hello Maven masters,
> > > > >
> > > > > For maven-compiler-plugin(a sample below), have a quick question.
> > > > > I
> > > read
> > > > > this document
> > > > > (http://maven.apache.org/plugins/maven-compiler-plugin/
> > 

Re: Maven and pre-emptive authentication

2015-03-30 Thread Gordon Cody
Hello James

It really does try twice. The first time it tries with no credentials
supplied.
This came to our attention when we upgraded from maven-2.0.9 to maven-3.0.5.

We found out at that time that it had to do with being compliant to some
web specification and there was no way to force it to use credentials on
the first attempt.

The delay is a mere fraction of a second for most files. On larger files it
can be slightly irritating.
We now avoid deploying ear files altogether by using the skip argument of
the deploy plugin.


Regards, Gord Cody



On Mon, Mar 30, 2015 at 4:34 AM, James Green 
wrote:

> I am a little confused. According to:
>
> https://maven.apache.org/guides/mini/guide-http-settings.html
>
> Maven 3.0.4 defaults to pre-emptive authentication for HTTP PUTs.
>
> According to my haproxy logs, each PUT is done twice:
>
> 1. PUT happens, receives a 401 response from Nexus
> 2. PUT happens, receives a 201 response from Nexus
>
> Our installed version:
> ii  maven 3.0.4-2
>   Java software project management and comprehension tool
>
> Is the documentation simply wrong or am I somehow mis-interpreting things?
>
> Thanks,
>
> James
>



-- 
Best Regards, Gord Cody

Release Manager  Zafin Labs Americas Inc.
179 Colonnade Road-Suite 100, Ottawa ON, Canada
Phone: +1 (613) 216-2504  Fax: +1 (613) 688-1374  Mobile: +1 613-601-2734
Web: http://zafin.com  Email: gordon.c...@zafin.com

-- 
Zafin - Canada

-- 
http://zafin.com



--

Connect with us

   
  

News and Events

Zafin joins the Deloitte Fast 50 and Fast 500 Rankings 





Running a specific intersection of tests using maven/spring/junit?

2015-03-30 Thread Leo Laskin
I have a number of tests identified using the Spring @IfProfileValue flag

@IfProfileValue{"a", "c"}
@Test
public void testA{ Do Stuff }

@IfProfileValue{"a", "b"}
@Test
public void testB{ Do Stuff }

@IfProfileValue{"a", "b"}
@Test
public void testC{ Do Stuff }

@IfProfileValue{"b"}
@Test
public void testD{ Do Stuff }
I can run all the tests using
"mvn clean install -Dtest-group=a -Dtest-group=b"

I want to run only the tests that match @IfProfileValue={"a","b") (Test
B/C) so is there a way to run only an intersection of these two values
using maven?

I saw https://jira.codehaus.org/browse/SUREFIRE-809 but wish
https://jira.codehaus.org/browse/SUREFIRE-808 had been implemented

Thanks for any help/suggestions you can provide.

-- 
*Leo Laskin*
Automation Architect, Spredfast Inc.
E :: llas...@spredfast.com
Spredfast Inc.´s Twitter  | Facebook
 | Blog 


Maven and pre-emptive authentication

2015-03-30 Thread James Green
I am a little confused. According to:

https://maven.apache.org/guides/mini/guide-http-settings.html

Maven 3.0.4 defaults to pre-emptive authentication for HTTP PUTs.

According to my haproxy logs, each PUT is done twice:

1. PUT happens, receives a 401 response from Nexus
2. PUT happens, receives a 201 response from Nexus

Our installed version:
ii  maven 3.0.4-2
  Java software project management and comprehension tool

Is the documentation simply wrong or am I somehow mis-interpreting things?

Thanks,

James


AW: about source and target in maven-compiler-plugin

2015-03-30 Thread Sebastian Oerding
Finally to finish this I tried a mini maven project containing the following 
class:

package Test;

public class Test {
public void foo() {
System.out.println(new StringBuilder("Hello world!"));
assert true;
}
}

Running mvn install gave me (stripped for the relevant part):

[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Test 
---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, 
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory 
C:\Users\sebastian.oerding\workspaces\workspace\Test\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Test ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. 
build is platform dependent!
[INFO] Compiling 1 source file to 
C:\Users\sebastian.oerding\workspaces\workspace\Test\target\classes
[INFO] -
[ERROR] COMPILATION ERROR :
[INFO] -
[ERROR] 
/C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/java/Test/Test.java:[6,17]
 C:\Users\sebastian.o
\Test.java:6: not a statement
[ERROR] 
/C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/java/Test/Test.java:[6,23]
 C:\Users\sebastian.o
\Test.java:6: ';' expected
[INFO] 2 errors
[INFO] -
[INFO] 
[INFO] BUILD FAILURE
[INFO] 
[INFO] Total time: 1.138 s
[INFO] Finished at: 2015-03-30T10:23:21+02:00
[INFO] Final Memory: 9M/152M
[INFO] 
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on 
project Tes
[ERROR] 
/C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/java/Test/Test.java:[6,17]
 C:\Users\sebastian.o
\Test.java:6: not a statement
[ERROR] 
/C:/Users/sebastian.oerding/workspaces/workspace/Test/src/main/java/Test/Test.java:[6,23]
 C:\Users\sebastian.o
\Test.java:6: ';' expected
[ERROR] -> [Help 1]

Hence new available API may be a special case but using features such as 
assertions not supported does really cause a compiler error (the maven 
installation used as JDK 1.6)

With regards
Sebastian

-Ursprüngliche Nachricht-
Von: Lin Ma [mailto:lin...@gmail.com] 
Gesendet: Montag, 30. März 2015 09:56
An: Maven Users List
Betreff: Re: about source and target in maven-compiler-plugin

Thanks all the same Sebastian. Your reply is very helpful and bring us further 
thoughts.

regards,
Lin

On Mon, Mar 30, 2015 at 12:47 AM, Sebastian Oerding < 
sebastian.oerd...@robotron.de> wrote:

> Hi Lin,
>
> I just tried my example and Maxim is right. I thought that the source 
> should take the API compatibility into account it seems that it is not 
> this way. Hence if the classes are successfully compiled (which 
> requires a JDK >
> 1.5) and you are executing them with Java 1.5 the StringBuilder class 
> will not be in place -> ClassNotFoundException (the class format 
> should be as needed for Java 1.5 due to the target).
>
> However I will not tell anymore about it as I'm not completely sure 
> about the moment and I do not have the time to really dig into this. Sorry.
> Detailed information about this is available in the net. In an earlier 
> email someone already provided links for the Maven documentation.
>
> Furthermore details about setting the compiler level can be found for 
> example in the Sun Certified Java Programmer Study Guide.
>
> With regards
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:38
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Hi Maxim,
>
> Why compiler will not fail? Supposing StringBuilder is a class in JDK 
> 1.6, but we force compiler to use 1.5 which has no such class? Please 
> feel free to correct me if I am wrong.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik 
> 
> wrote:
>
> > If I'm not mistaken compiler will not fail in this case BUT the 
> > application will fail in runtime (in case Java 1.5 is used) due to 
> > StringBuilder class is missing in JDK
> >
> > On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
> >
> > > Thanks Sebastian,
> > >
> > > 1. I am using JDK 1.7/1.8 for both development and deployment in 
> > > runtime, shall I change 1.5 of source and target to 1.7/1.8?
> > >
> > > 2. In your example, "for example you can write source code using a 
> > > JDK
> > 1.6
> > > which is compliant to Java 1.5. However you can also use the
> > StringBuilder
> > > class wh

AW: about source and target in maven-compiler-plugin

2015-03-30 Thread Sebastian Oerding
As I felt unfomfortable leaving it as it is I checked
http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
where there was the following hint on the target tag:
Note: Merely setting the target option does not guarantee that your code 
actually runs on a JRE with the specified version. The pitfall is unintended 
usage of APIs that only exist in later JREs which would make your code fail at 
runtime with a linkage error. To avoid this issue, you can either configure the 
compiler's boot classpath to match the target JRE or use the Animal Sniffer 
Maven Plugin to verify your code doesn't use unintended APIs.

With regards
Sebastian


-Ursprüngliche Nachricht-
Von: Lin Ma [mailto:lin...@gmail.com] 
Gesendet: Montag, 30. März 2015 09:56
An: Maven Users List
Betreff: Re: about source and target in maven-compiler-plugin

Thanks all the same Sebastian. Your reply is very helpful and bring us further 
thoughts.

regards,
Lin

On Mon, Mar 30, 2015 at 12:47 AM, Sebastian Oerding < 
sebastian.oerd...@robotron.de> wrote:

> Hi Lin,
>
> I just tried my example and Maxim is right. I thought that the source 
> should take the API compatibility into account it seems that it is not 
> this way. Hence if the classes are successfully compiled (which 
> requires a JDK >
> 1.5) and you are executing them with Java 1.5 the StringBuilder class 
> will not be in place -> ClassNotFoundException (the class format 
> should be as needed for Java 1.5 due to the target).
>
> However I will not tell anymore about it as I'm not completely sure 
> about the moment and I do not have the time to really dig into this. Sorry.
> Detailed information about this is available in the net. In an earlier 
> email someone already provided links for the Maven documentation.
>
> Furthermore details about setting the compiler level can be found for 
> example in the Sun Certified Java Programmer Study Guide.
>
> With regards
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:38
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Hi Maxim,
>
> Why compiler will not fail? Supposing StringBuilder is a class in JDK 
> 1.6, but we force compiler to use 1.5 which has no such class? Please 
> feel free to correct me if I am wrong.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik 
> 
> wrote:
>
> > If I'm not mistaken compiler will not fail in this case BUT the 
> > application will fail in runtime (in case Java 1.5 is used) due to 
> > StringBuilder class is missing in JDK
> >
> > On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
> >
> > > Thanks Sebastian,
> > >
> > > 1. I am using JDK 1.7/1.8 for both development and deployment in 
> > > runtime, shall I change 1.5 of source and target to 1.7/1.8?
> > >
> > > 2. In your example, "for example you can write source code using a 
> > > JDK
> > 1.6
> > > which is compliant to Java 1.5. However you can also use the
> > StringBuilder
> > > class which does not exist in Java 1.5", I think using JDK 1.6 
> > > specific feature but using 1.5 complier will fail? No? Please feel 
> > > free to correct me.
> > >
> > > regards,
> > > Lin
> > >
> > > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding < 
> > > sebastian.oerd...@robotron.de> wrote:
> > >
> > > > source -> The level (JDK version) to which the source code must 
> > > > be compliant to, for example you can write source code using a 
> > > > JDK
> > > > 1.6
> > which
> > > > is compliant to Java 1.5. However you can also use the 
> > > > StringBuilder
> > > class
> > > > which does not exist in Java 1.5 target -> The class version of 
> > > > the generated class files. The class
> > > format
> > > > changes with some Java version, for example as some stuff may be 
> > > > added
> > > for
> > > > performance reason. For example if a new byte code instruction 
> > > > comes up (like 'invokedynamic') this really makes a change. Or 
> > > > another example
> > > (I'm
> > > > not really sure about it): As far as I think a stack map has 
> > > > been added from Java 5 to Java 1.6. This should improve 
> > > > performance and makes
> > subtle
> > > > differences when ClassNotFoundException are thrown. You can use 
> > > > a JDK
> > to
> > > > compile code for different but lower versions. This way can 
> > > > benefit
> > from
> > > > some optimizations which weren't available with the old JDK and 
> > > > are compatible.
> > > >
> > > > With regards
> > > > Sebastian
> > > >
> > > > -Ursprüngliche Nachricht-
> > > > Von: Lin Ma [mailto:lin...@gmail.com]
> > > > Gesendet: Montag, 30. März 2015 07:46
> > > > An: Maven Users List
> > > > Betreff: about source and target in maven-compiler-plugin
> > > >
> > > > Hello Maven masters,
> > > >
> > > > For maven-compiler-plugin(a sample below), have a quick question.
> > > > I
> > read
> > > > this document
> > > > (http://maven.

AW: about source and target in maven-compiler-plugin

2015-03-30 Thread Sebastian Oerding
pom.xml uses inheritance. There is a so called 'super POM' provided with the 
maven installation from which all entries are inherited if not added / 
overwritten by you.

Newer versions of Maven have Java 1.6 as default.

With regards
Sebastian

-Ursprüngliche Nachricht-
Von: Lin Ma [mailto:lin...@gmail.com] 
Gesendet: Montag, 30. März 2015 09:56
An: Maven Users List
Betreff: Re: about source and target in maven-compiler-plugin

Thanks all the same Sebastian. Your reply is very helpful and bring us further 
thoughts.

regards,
Lin

On Mon, Mar 30, 2015 at 12:47 AM, Sebastian Oerding < 
sebastian.oerd...@robotron.de> wrote:

> Hi Lin,
>
> I just tried my example and Maxim is right. I thought that the source 
> should take the API compatibility into account it seems that it is not 
> this way. Hence if the classes are successfully compiled (which 
> requires a JDK >
> 1.5) and you are executing them with Java 1.5 the StringBuilder class 
> will not be in place -> ClassNotFoundException (the class format 
> should be as needed for Java 1.5 due to the target).
>
> However I will not tell anymore about it as I'm not completely sure 
> about the moment and I do not have the time to really dig into this. Sorry.
> Detailed information about this is available in the net. In an earlier 
> email someone already provided links for the Maven documentation.
>
> Furthermore details about setting the compiler level can be found for 
> example in the Sun Certified Java Programmer Study Guide.
>
> With regards
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:38
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Hi Maxim,
>
> Why compiler will not fail? Supposing StringBuilder is a class in JDK 
> 1.6, but we force compiler to use 1.5 which has no such class? Please 
> feel free to correct me if I am wrong.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik 
> 
> wrote:
>
> > If I'm not mistaken compiler will not fail in this case BUT the 
> > application will fail in runtime (in case Java 1.5 is used) due to 
> > StringBuilder class is missing in JDK
> >
> > On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
> >
> > > Thanks Sebastian,
> > >
> > > 1. I am using JDK 1.7/1.8 for both development and deployment in 
> > > runtime, shall I change 1.5 of source and target to 1.7/1.8?
> > >
> > > 2. In your example, "for example you can write source code using a 
> > > JDK
> > 1.6
> > > which is compliant to Java 1.5. However you can also use the
> > StringBuilder
> > > class which does not exist in Java 1.5", I think using JDK 1.6 
> > > specific feature but using 1.5 complier will fail? No? Please feel 
> > > free to correct me.
> > >
> > > regards,
> > > Lin
> > >
> > > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding < 
> > > sebastian.oerd...@robotron.de> wrote:
> > >
> > > > source -> The level (JDK version) to which the source code must 
> > > > be compliant to, for example you can write source code using a 
> > > > JDK
> > > > 1.6
> > which
> > > > is compliant to Java 1.5. However you can also use the 
> > > > StringBuilder
> > > class
> > > > which does not exist in Java 1.5 target -> The class version of 
> > > > the generated class files. The class
> > > format
> > > > changes with some Java version, for example as some stuff may be 
> > > > added
> > > for
> > > > performance reason. For example if a new byte code instruction 
> > > > comes up (like 'invokedynamic') this really makes a change. Or 
> > > > another example
> > > (I'm
> > > > not really sure about it): As far as I think a stack map has 
> > > > been added from Java 5 to Java 1.6. This should improve 
> > > > performance and makes
> > subtle
> > > > differences when ClassNotFoundException are thrown. You can use 
> > > > a JDK
> > to
> > > > compile code for different but lower versions. This way can 
> > > > benefit
> > from
> > > > some optimizations which weren't available with the old JDK and 
> > > > are compatible.
> > > >
> > > > With regards
> > > > Sebastian
> > > >
> > > > -Ursprüngliche Nachricht-
> > > > Von: Lin Ma [mailto:lin...@gmail.com]
> > > > Gesendet: Montag, 30. März 2015 07:46
> > > > An: Maven Users List
> > > > Betreff: about source and target in maven-compiler-plugin
> > > >
> > > > Hello Maven masters,
> > > >
> > > > For maven-compiler-plugin(a sample below), have a quick question.
> > > > I
> > read
> > > > this document
> > > > (http://maven.apache.org/plugins/maven-compiler-plugin/
> > ),
> > > > and confused what means source and target 1.5 here, it seems it 
> > > > is an internal version number of Maven, independent of JDK?
> > > >
> > > > 
> > > > maven-compiler-plugin
> > > > 2.3.2
> > > > 
> > > > 1.5
> > > > 1.5
> > > > 
> > > > 
> > > >
> > > > thanks in advance,
> > > > Lin
> > > >
> > > > --

Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Lin Ma
Thanks all the same Sebastian. Your reply is very helpful and bring us
further thoughts.

regards,
Lin

On Mon, Mar 30, 2015 at 12:47 AM, Sebastian Oerding <
sebastian.oerd...@robotron.de> wrote:

> Hi Lin,
>
> I just tried my example and Maxim is right. I thought that the source
> should take the API compatibility into account it seems that it is not this
> way. Hence if the classes are successfully compiled (which requires a JDK >
> 1.5) and you are executing them with Java 1.5 the StringBuilder class will
> not be in place -> ClassNotFoundException (the class format should be as
> needed for Java 1.5 due to the target).
>
> However I will not tell anymore about it as I'm not completely sure about
> the moment and I do not have the time to really dig into this. Sorry.
> Detailed information about this is available in the net. In an earlier
> email someone already provided links for the Maven documentation.
>
> Furthermore details about setting the compiler level can be found for
> example in the Sun Certified Java Programmer Study Guide.
>
> With regards
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:38
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Hi Maxim,
>
> Why compiler will not fail? Supposing StringBuilder is a class in JDK 1.6,
> but we force compiler to use 1.5 which has no such class? Please feel free
> to correct me if I am wrong.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik 
> wrote:
>
> > If I'm not mistaken compiler will not fail in this case BUT the
> > application will fail in runtime (in case Java 1.5 is used) due to
> > StringBuilder class is missing in JDK
> >
> > On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
> >
> > > Thanks Sebastian,
> > >
> > > 1. I am using JDK 1.7/1.8 for both development and deployment in
> > > runtime, shall I change 1.5 of source and target to 1.7/1.8?
> > >
> > > 2. In your example, "for example you can write source code using a
> > > JDK
> > 1.6
> > > which is compliant to Java 1.5. However you can also use the
> > StringBuilder
> > > class which does not exist in Java 1.5", I think using JDK 1.6
> > > specific feature but using 1.5 complier will fail? No? Please feel
> > > free to correct me.
> > >
> > > regards,
> > > Lin
> > >
> > > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding <
> > > sebastian.oerd...@robotron.de> wrote:
> > >
> > > > source -> The level (JDK version) to which the source code must be
> > > > compliant to, for example you can write source code using a JDK
> > > > 1.6
> > which
> > > > is compliant to Java 1.5. However you can also use the
> > > > StringBuilder
> > > class
> > > > which does not exist in Java 1.5
> > > > target -> The class version of the generated class files. The
> > > > class
> > > format
> > > > changes with some Java version, for example as some stuff may be
> > > > added
> > > for
> > > > performance reason. For example if a new byte code instruction
> > > > comes up (like 'invokedynamic') this really makes a change. Or
> > > > another example
> > > (I'm
> > > > not really sure about it): As far as I think a stack map has been
> > > > added from Java 5 to Java 1.6. This should improve performance and
> > > > makes
> > subtle
> > > > differences when ClassNotFoundException are thrown. You can use a
> > > > JDK
> > to
> > > > compile code for different but lower versions. This way can
> > > > benefit
> > from
> > > > some optimizations which weren't available with the old JDK and
> > > > are compatible.
> > > >
> > > > With regards
> > > > Sebastian
> > > >
> > > > -Ursprüngliche Nachricht-
> > > > Von: Lin Ma [mailto:lin...@gmail.com]
> > > > Gesendet: Montag, 30. März 2015 07:46
> > > > An: Maven Users List
> > > > Betreff: about source and target in maven-compiler-plugin
> > > >
> > > > Hello Maven masters,
> > > >
> > > > For maven-compiler-plugin(a sample below), have a quick question.
> > > > I
> > read
> > > > this document
> > > > (http://maven.apache.org/plugins/maven-compiler-plugin/
> > ),
> > > > and confused what means source and target 1.5 here, it seems it is
> > > > an internal version number of Maven, independent of JDK?
> > > >
> > > > 
> > > > maven-compiler-plugin
> > > > 2.3.2
> > > > 
> > > > 1.5
> > > > 1.5
> > > > 
> > > > 
> > > >
> > > > thanks in advance,
> > > > Lin
> > > >
> > > > --
> > > > --- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > > > For additional commands, e-mail: users-h...@maven.apache.org
> > > >
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>


Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Lin Ma
Thanks Maxim,

Good point! I am not sure why Maven makes 1.5 as default, it seems a pretty
old version of JDK.

regards,
Lin

On Mon, Mar 30, 2015 at 12:44 AM, Maxim Solodovnik 
wrote:

> Hello Lin,
>
> We had this issue in this project: https://github.com/Red5/red5-server
> Here is the report:
> https://groups.google.com/d/msg/red5interest/EbVFdFkEGWE/1N_eqcz5K-UJ
>
> Somehow class was missing in runtime after building with Java8
> rebuilding with Java7 fixes the problem
>
> On Mon, Mar 30, 2015 at 1:38 PM, Lin Ma  wrote:
>
> > Hi Maxim,
> >
> > Why compiler will not fail? Supposing StringBuilder is a class in JDK
> 1.6,
> > but we force compiler to use 1.5 which has no such class? Please feel
> free
> > to correct me if I am wrong.
> >
> > regards,
> > Lin
> >
> > On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik  >
> > wrote:
> >
> > > If I'm not mistaken compiler will not fail in this case
> > > BUT the application will fail in runtime (in case Java 1.5 is used)
> > > due to StringBuilder
> > > class is missing in JDK
> > >
> > > On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
> > >
> > > > Thanks Sebastian,
> > > >
> > > > 1. I am using JDK 1.7/1.8 for both development and deployment in
> > runtime,
> > > > shall I change 1.5 of source and target to 1.7/1.8?
> > > >
> > > > 2. In your example, "for example you can write source code using a
> JDK
> > > 1.6
> > > > which is compliant to Java 1.5. However you can also use the
> > > StringBuilder
> > > > class which does not exist in Java 1.5", I think using JDK 1.6
> specific
> > > > feature but using 1.5 complier will fail? No? Please feel free to
> > correct
> > > > me.
> > > >
> > > > regards,
> > > > Lin
> > > >
> > > > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding <
> > > > sebastian.oerd...@robotron.de> wrote:
> > > >
> > > > > source -> The level (JDK version) to which the source code must be
> > > > > compliant to, for example you can write source code using a JDK 1.6
> > > which
> > > > > is compliant to Java 1.5. However you can also use the
> StringBuilder
> > > > class
> > > > > which does not exist in Java 1.5
> > > > > target -> The class version of the generated class files. The class
> > > > format
> > > > > changes with some Java version, for example as some stuff may be
> > added
> > > > for
> > > > > performance reason. For example if a new byte code instruction
> comes
> > up
> > > > > (like 'invokedynamic') this really makes a change. Or another
> example
> > > > (I'm
> > > > > not really sure about it): As far as I think a stack map has been
> > added
> > > > > from Java 5 to Java 1.6. This should improve performance and makes
> > > subtle
> > > > > differences when ClassNotFoundException are thrown. You can use a
> JDK
> > > to
> > > > > compile code for different but lower versions. This way can benefit
> > > from
> > > > > some optimizations which weren't available with the old JDK and are
> > > > > compatible.
> > > > >
> > > > > With regards
> > > > > Sebastian
> > > > >
> > > > > -Ursprüngliche Nachricht-
> > > > > Von: Lin Ma [mailto:lin...@gmail.com]
> > > > > Gesendet: Montag, 30. März 2015 07:46
> > > > > An: Maven Users List
> > > > > Betreff: about source and target in maven-compiler-plugin
> > > > >
> > > > > Hello Maven masters,
> > > > >
> > > > > For maven-compiler-plugin(a sample below), have a quick question. I
> > > read
> > > > > this document (
> > http://maven.apache.org/plugins/maven-compiler-plugin/
> > > ),
> > > > > and confused what means source and target 1.5 here, it seems it is
> an
> > > > > internal version number of Maven, independent of JDK?
> > > > >
> > > > > 
> > > > > maven-compiler-plugin
> > > > > 2.3.2
> > > > > 
> > > > > 1.5
> > > > > 1.5
> > > > > 
> > > > > 
> > > > >
> > > > > thanks in advance,
> > > > > Lin
> > > > >
> > > > >
> -
> > > > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > > > > For additional commands, e-mail: users-h...@maven.apache.org
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>


AW: about source and target in maven-compiler-plugin

2015-03-30 Thread Sebastian Oerding
Hi Lin,

I just tried my example and Maxim is right. I thought that the source should 
take the API compatibility into account it seems that it is not this way. Hence 
if the classes are successfully compiled (which requires a JDK > 1.5) and you 
are executing them with Java 1.5 the StringBuilder class will not be in place 
-> ClassNotFoundException (the class format should be as needed for Java 1.5 
due to the target).

However I will not tell anymore about it as I'm not completely sure about the 
moment and I do not have the time to really dig into this. Sorry. Detailed 
information about this is available in the net. In an earlier email someone 
already provided links for the Maven documentation.

Furthermore details about setting the compiler level can be found for example 
in the Sun Certified Java Programmer Study Guide.

With regards
Sebastian

-Ursprüngliche Nachricht-
Von: Lin Ma [mailto:lin...@gmail.com] 
Gesendet: Montag, 30. März 2015 09:38
An: Maven Users List
Betreff: Re: about source and target in maven-compiler-plugin

Hi Maxim,

Why compiler will not fail? Supposing StringBuilder is a class in JDK 1.6, but 
we force compiler to use 1.5 which has no such class? Please feel free to 
correct me if I am wrong.

regards,
Lin

On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik 
wrote:

> If I'm not mistaken compiler will not fail in this case BUT the 
> application will fail in runtime (in case Java 1.5 is used) due to 
> StringBuilder class is missing in JDK
>
> On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
>
> > Thanks Sebastian,
> >
> > 1. I am using JDK 1.7/1.8 for both development and deployment in 
> > runtime, shall I change 1.5 of source and target to 1.7/1.8?
> >
> > 2. In your example, "for example you can write source code using a 
> > JDK
> 1.6
> > which is compliant to Java 1.5. However you can also use the
> StringBuilder
> > class which does not exist in Java 1.5", I think using JDK 1.6 
> > specific feature but using 1.5 complier will fail? No? Please feel 
> > free to correct me.
> >
> > regards,
> > Lin
> >
> > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding < 
> > sebastian.oerd...@robotron.de> wrote:
> >
> > > source -> The level (JDK version) to which the source code must be 
> > > compliant to, for example you can write source code using a JDK 
> > > 1.6
> which
> > > is compliant to Java 1.5. However you can also use the 
> > > StringBuilder
> > class
> > > which does not exist in Java 1.5
> > > target -> The class version of the generated class files. The 
> > > class
> > format
> > > changes with some Java version, for example as some stuff may be 
> > > added
> > for
> > > performance reason. For example if a new byte code instruction 
> > > comes up (like 'invokedynamic') this really makes a change. Or 
> > > another example
> > (I'm
> > > not really sure about it): As far as I think a stack map has been 
> > > added from Java 5 to Java 1.6. This should improve performance and 
> > > makes
> subtle
> > > differences when ClassNotFoundException are thrown. You can use a 
> > > JDK
> to
> > > compile code for different but lower versions. This way can 
> > > benefit
> from
> > > some optimizations which weren't available with the old JDK and 
> > > are compatible.
> > >
> > > With regards
> > > Sebastian
> > >
> > > -Ursprüngliche Nachricht-
> > > Von: Lin Ma [mailto:lin...@gmail.com]
> > > Gesendet: Montag, 30. März 2015 07:46
> > > An: Maven Users List
> > > Betreff: about source and target in maven-compiler-plugin
> > >
> > > Hello Maven masters,
> > >
> > > For maven-compiler-plugin(a sample below), have a quick question. 
> > > I
> read
> > > this document 
> > > (http://maven.apache.org/plugins/maven-compiler-plugin/
> ),
> > > and confused what means source and target 1.5 here, it seems it is 
> > > an internal version number of Maven, independent of JDK?
> > >
> > > 
> > > maven-compiler-plugin
> > > 2.3.2
> > > 
> > > 1.5
> > > 1.5
> > > 
> > > 
> > >
> > > thanks in advance,
> > > Lin
> > >
> > > --
> > > --- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > > For additional commands, e-mail: users-h...@maven.apache.org
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>


Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Lin Ma
Thanks Sebastian,

In your case #1, I should use 1.5 as target and 1.8 as source in order to
use TLS feature and compile class file to be 1.5 compatible?

regards,
Lin

On Mon, Mar 30, 2015 at 12:34 AM, Sebastian Oerding <
sebastian.oerd...@robotron.de> wrote:

> Hi Lin,
>
> 1) In general you should use Java 1.7 / 1.8. However you may have specific
> requirements which free you from the choice:
> For example the customer may explicitly request a specific Java version
> you have to support. Then the class files delivered  by you must conform to
> this Java version (however it is not mandatory for a new Java version to
> break class version format compatibility).
> On the other side you may have to support TLS 1.2 which has been added to
> Java with version 1.8 (frequently spoken due for some cipher suites or a
> fixed bug which prevented RSA key with more than 1024 characters in TLS
> handshake / key exchange / negotiation)
>
> 2) My post had been to short and thus confusing. Yes you are right. I
> meant that if using a Java 1.6 feature you will not be able to compile this
> with a source level of 1.5.
>
> Regards
> Sebastian
>
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 09:20
> An: Maven Users List
> Betreff: Re: about source and target in maven-compiler-plugin
>
> Thanks Sebastian,
>
> 1. I am using JDK 1.7/1.8 for both development and deployment in runtime,
> shall I change 1.5 of source and target to 1.7/1.8?
>
> 2. In your example, "for example you can write source code using a JDK 1.6
> which is compliant to Java 1.5. However you can also use the StringBuilder
> class which does not exist in Java 1.5", I think using JDK 1.6 specific
> feature but using 1.5 complier will fail? No? Please feel free to correct
> me.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding <
> sebastian.oerd...@robotron.de> wrote:
>
> > source -> The level (JDK version) to which the source code must be
> > compliant to, for example you can write source code using a JDK 1.6
> > which is compliant to Java 1.5. However you can also use the
> > StringBuilder class which does not exist in Java 1.5 target -> The
> > class version of the generated class files. The class format changes
> > with some Java version, for example as some stuff may be added for
> > performance reason. For example if a new byte code instruction comes
> > up (like 'invokedynamic') this really makes a change. Or another
> > example (I'm not really sure about it): As far as I think a stack map
> > has been added from Java 5 to Java 1.6. This should improve
> > performance and makes subtle differences when ClassNotFoundException
> > are thrown. You can use a JDK to compile code for different but lower
> > versions. This way can benefit from some optimizations which weren't
> > available with the old JDK and are compatible.
> >
> > With regards
> > Sebastian
> >
> > -Ursprüngliche Nachricht-
> > Von: Lin Ma [mailto:lin...@gmail.com]
> > Gesendet: Montag, 30. März 2015 07:46
> > An: Maven Users List
> > Betreff: about source and target in maven-compiler-plugin
> >
> > Hello Maven masters,
> >
> > For maven-compiler-plugin(a sample below), have a quick question. I
> > read this document
> > (http://maven.apache.org/plugins/maven-compiler-plugin/),
> > and confused what means source and target 1.5 here, it seems it is an
> > internal version number of Maven, independent of JDK?
> >
> > 
> > maven-compiler-plugin
> > 2.3.2
> > 
> > 1.5
> > 1.5
> > 
> > 
> >
> > thanks in advance,
> > Lin
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>


Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Maxim Solodovnik
Hello Lin,

We had this issue in this project: https://github.com/Red5/red5-server
Here is the report:
https://groups.google.com/d/msg/red5interest/EbVFdFkEGWE/1N_eqcz5K-UJ

Somehow class was missing in runtime after building with Java8
rebuilding with Java7 fixes the problem

On Mon, Mar 30, 2015 at 1:38 PM, Lin Ma  wrote:

> Hi Maxim,
>
> Why compiler will not fail? Supposing StringBuilder is a class in JDK 1.6,
> but we force compiler to use 1.5 which has no such class? Please feel free
> to correct me if I am wrong.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik 
> wrote:
>
> > If I'm not mistaken compiler will not fail in this case
> > BUT the application will fail in runtime (in case Java 1.5 is used)
> > due to StringBuilder
> > class is missing in JDK
> >
> > On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
> >
> > > Thanks Sebastian,
> > >
> > > 1. I am using JDK 1.7/1.8 for both development and deployment in
> runtime,
> > > shall I change 1.5 of source and target to 1.7/1.8?
> > >
> > > 2. In your example, "for example you can write source code using a JDK
> > 1.6
> > > which is compliant to Java 1.5. However you can also use the
> > StringBuilder
> > > class which does not exist in Java 1.5", I think using JDK 1.6 specific
> > > feature but using 1.5 complier will fail? No? Please feel free to
> correct
> > > me.
> > >
> > > regards,
> > > Lin
> > >
> > > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding <
> > > sebastian.oerd...@robotron.de> wrote:
> > >
> > > > source -> The level (JDK version) to which the source code must be
> > > > compliant to, for example you can write source code using a JDK 1.6
> > which
> > > > is compliant to Java 1.5. However you can also use the StringBuilder
> > > class
> > > > which does not exist in Java 1.5
> > > > target -> The class version of the generated class files. The class
> > > format
> > > > changes with some Java version, for example as some stuff may be
> added
> > > for
> > > > performance reason. For example if a new byte code instruction comes
> up
> > > > (like 'invokedynamic') this really makes a change. Or another example
> > > (I'm
> > > > not really sure about it): As far as I think a stack map has been
> added
> > > > from Java 5 to Java 1.6. This should improve performance and makes
> > subtle
> > > > differences when ClassNotFoundException are thrown. You can use a JDK
> > to
> > > > compile code for different but lower versions. This way can benefit
> > from
> > > > some optimizations which weren't available with the old JDK and are
> > > > compatible.
> > > >
> > > > With regards
> > > > Sebastian
> > > >
> > > > -Ursprüngliche Nachricht-
> > > > Von: Lin Ma [mailto:lin...@gmail.com]
> > > > Gesendet: Montag, 30. März 2015 07:46
> > > > An: Maven Users List
> > > > Betreff: about source and target in maven-compiler-plugin
> > > >
> > > > Hello Maven masters,
> > > >
> > > > For maven-compiler-plugin(a sample below), have a quick question. I
> > read
> > > > this document (
> http://maven.apache.org/plugins/maven-compiler-plugin/
> > ),
> > > > and confused what means source and target 1.5 here, it seems it is an
> > > > internal version number of Maven, independent of JDK?
> > > >
> > > > 
> > > > maven-compiler-plugin
> > > > 2.3.2
> > > > 
> > > > 1.5
> > > > 1.5
> > > > 
> > > > 
> > > >
> > > > thanks in advance,
> > > > Lin
> > > >
> > > > -
> > > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > > > For additional commands, e-mail: users-h...@maven.apache.org
> > > >
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax


Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Lin Ma
Hi Maxim,

Why compiler will not fail? Supposing StringBuilder is a class in JDK 1.6,
but we force compiler to use 1.5 which has no such class? Please feel free
to correct me if I am wrong.

regards,
Lin

On Mon, Mar 30, 2015 at 12:33 AM, Maxim Solodovnik 
wrote:

> If I'm not mistaken compiler will not fail in this case
> BUT the application will fail in runtime (in case Java 1.5 is used)
> due to StringBuilder
> class is missing in JDK
>
> On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:
>
> > Thanks Sebastian,
> >
> > 1. I am using JDK 1.7/1.8 for both development and deployment in runtime,
> > shall I change 1.5 of source and target to 1.7/1.8?
> >
> > 2. In your example, "for example you can write source code using a JDK
> 1.6
> > which is compliant to Java 1.5. However you can also use the
> StringBuilder
> > class which does not exist in Java 1.5", I think using JDK 1.6 specific
> > feature but using 1.5 complier will fail? No? Please feel free to correct
> > me.
> >
> > regards,
> > Lin
> >
> > On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding <
> > sebastian.oerd...@robotron.de> wrote:
> >
> > > source -> The level (JDK version) to which the source code must be
> > > compliant to, for example you can write source code using a JDK 1.6
> which
> > > is compliant to Java 1.5. However you can also use the StringBuilder
> > class
> > > which does not exist in Java 1.5
> > > target -> The class version of the generated class files. The class
> > format
> > > changes with some Java version, for example as some stuff may be added
> > for
> > > performance reason. For example if a new byte code instruction comes up
> > > (like 'invokedynamic') this really makes a change. Or another example
> > (I'm
> > > not really sure about it): As far as I think a stack map has been added
> > > from Java 5 to Java 1.6. This should improve performance and makes
> subtle
> > > differences when ClassNotFoundException are thrown. You can use a JDK
> to
> > > compile code for different but lower versions. This way can benefit
> from
> > > some optimizations which weren't available with the old JDK and are
> > > compatible.
> > >
> > > With regards
> > > Sebastian
> > >
> > > -Ursprüngliche Nachricht-
> > > Von: Lin Ma [mailto:lin...@gmail.com]
> > > Gesendet: Montag, 30. März 2015 07:46
> > > An: Maven Users List
> > > Betreff: about source and target in maven-compiler-plugin
> > >
> > > Hello Maven masters,
> > >
> > > For maven-compiler-plugin(a sample below), have a quick question. I
> read
> > > this document (http://maven.apache.org/plugins/maven-compiler-plugin/
> ),
> > > and confused what means source and target 1.5 here, it seems it is an
> > > internal version number of Maven, independent of JDK?
> > >
> > > 
> > > maven-compiler-plugin
> > > 2.3.2
> > > 
> > > 1.5
> > > 1.5
> > > 
> > > 
> > >
> > > thanks in advance,
> > > Lin
> > >
> > > -
> > > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > > For additional commands, e-mail: users-h...@maven.apache.org
> > >
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>


AW: about source and target in maven-compiler-plugin

2015-03-30 Thread Sebastian Oerding
Hi Lin,

1) In general you should use Java 1.7 / 1.8. However you may have specific 
requirements which free you from the choice:
For example the customer may explicitly request a specific Java version you 
have to support. Then the class files delivered  by you must conform to this 
Java version (however it is not mandatory for a new Java version to break class 
version format compatibility).
On the other side you may have to support TLS 1.2 which has been added to Java 
with version 1.8 (frequently spoken due for some cipher suites or a fixed bug 
which prevented RSA key with more than 1024 characters in TLS handshake / key 
exchange / negotiation)

2) My post had been to short and thus confusing. Yes you are right. I meant 
that if using a Java 1.6 feature you will not be able to compile this with a 
source level of 1.5.

Regards
Sebastian


-Ursprüngliche Nachricht-
Von: Lin Ma [mailto:lin...@gmail.com] 
Gesendet: Montag, 30. März 2015 09:20
An: Maven Users List
Betreff: Re: about source and target in maven-compiler-plugin

Thanks Sebastian,

1. I am using JDK 1.7/1.8 for both development and deployment in runtime, shall 
I change 1.5 of source and target to 1.7/1.8?

2. In your example, "for example you can write source code using a JDK 1.6 
which is compliant to Java 1.5. However you can also use the StringBuilder 
class which does not exist in Java 1.5", I think using JDK 1.6 specific feature 
but using 1.5 complier will fail? No? Please feel free to correct me.

regards,
Lin

On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding < 
sebastian.oerd...@robotron.de> wrote:

> source -> The level (JDK version) to which the source code must be 
> compliant to, for example you can write source code using a JDK 1.6 
> which is compliant to Java 1.5. However you can also use the 
> StringBuilder class which does not exist in Java 1.5 target -> The 
> class version of the generated class files. The class format changes 
> with some Java version, for example as some stuff may be added for 
> performance reason. For example if a new byte code instruction comes 
> up (like 'invokedynamic') this really makes a change. Or another 
> example (I'm not really sure about it): As far as I think a stack map 
> has been added from Java 5 to Java 1.6. This should improve 
> performance and makes subtle differences when ClassNotFoundException 
> are thrown. You can use a JDK to compile code for different but lower 
> versions. This way can benefit from some optimizations which weren't 
> available with the old JDK and are compatible.
>
> With regards
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 07:46
> An: Maven Users List
> Betreff: about source and target in maven-compiler-plugin
>
> Hello Maven masters,
>
> For maven-compiler-plugin(a sample below), have a quick question. I 
> read this document 
> (http://maven.apache.org/plugins/maven-compiler-plugin/),
> and confused what means source and target 1.5 here, it seems it is an 
> internal version number of Maven, independent of JDK?
>
> 
> maven-compiler-plugin
> 2.3.2
> 
> 1.5
> 1.5
> 
> 
>
> thanks in advance,
> Lin
>
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>

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


Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Maxim Solodovnik
If I'm not mistaken compiler will not fail in this case
BUT the application will fail in runtime (in case Java 1.5 is used)
due to StringBuilder
class is missing in JDK

On Mon, Mar 30, 2015 at 1:20 PM, Lin Ma  wrote:

> Thanks Sebastian,
>
> 1. I am using JDK 1.7/1.8 for both development and deployment in runtime,
> shall I change 1.5 of source and target to 1.7/1.8?
>
> 2. In your example, "for example you can write source code using a JDK 1.6
> which is compliant to Java 1.5. However you can also use the StringBuilder
> class which does not exist in Java 1.5", I think using JDK 1.6 specific
> feature but using 1.5 complier will fail? No? Please feel free to correct
> me.
>
> regards,
> Lin
>
> On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding <
> sebastian.oerd...@robotron.de> wrote:
>
> > source -> The level (JDK version) to which the source code must be
> > compliant to, for example you can write source code using a JDK 1.6 which
> > is compliant to Java 1.5. However you can also use the StringBuilder
> class
> > which does not exist in Java 1.5
> > target -> The class version of the generated class files. The class
> format
> > changes with some Java version, for example as some stuff may be added
> for
> > performance reason. For example if a new byte code instruction comes up
> > (like 'invokedynamic') this really makes a change. Or another example
> (I'm
> > not really sure about it): As far as I think a stack map has been added
> > from Java 5 to Java 1.6. This should improve performance and makes subtle
> > differences when ClassNotFoundException are thrown. You can use a JDK to
> > compile code for different but lower versions. This way can benefit from
> > some optimizations which weren't available with the old JDK and are
> > compatible.
> >
> > With regards
> > Sebastian
> >
> > -Ursprüngliche Nachricht-
> > Von: Lin Ma [mailto:lin...@gmail.com]
> > Gesendet: Montag, 30. März 2015 07:46
> > An: Maven Users List
> > Betreff: about source and target in maven-compiler-plugin
> >
> > Hello Maven masters,
> >
> > For maven-compiler-plugin(a sample below), have a quick question. I read
> > this document (http://maven.apache.org/plugins/maven-compiler-plugin/),
> > and confused what means source and target 1.5 here, it seems it is an
> > internal version number of Maven, independent of JDK?
> >
> > 
> > maven-compiler-plugin
> > 2.3.2
> > 
> > 1.5
> > 1.5
> > 
> > 
> >
> > thanks in advance,
> > Lin
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> > For additional commands, e-mail: users-h...@maven.apache.org
> >
>



-- 
WBR
Maxim aka solomax


AW: AW: maven-release-plugin / SVN credentials

2015-03-30 Thread Sebastian Oerding
Hello Robert,

svn works perfectly fine using the command line or the installed Tortoise SVN 
or using Subversion.
If invoking maven from the command line I do not have to provide credentials 
(just committed something where a change was sent to the server to verify 
that). Hence the SVN must take the credentials from somewhere which is related 
to the Active Directory / Kerberos ticket.

However this seems to fail if using the maven-release-plugin. However this may 
relate to
https://jira.codehaus.org/browse/MRELEASE-892
as there is also an error message to use --force interactive to make the 
maven-release-plugin to request the credentials.

I'll try with version 2.5.2 of the maven-release-plugin.

With regards
Sebastian

-Ursprüngliche Nachricht-
Von: Robert Scholte [mailto:rfscho...@apache.org] 
Gesendet: Freitag, 27. März 2015 22:02
An: Maven Users List
Betreff: Re: AW: maven-release-plugin / SVN credentials

Hi Sebastian,

this is first of all more an svn commandline issue rather than a Maven / 
maven-release-plugin issue.
For that reason you should start by calling svn directly from the commandline. 
In the end, that's exactly what maven-release-plugin (actually the 
scm-svn-provider) does. Once it can be called from commandline, it should be a 
simple step to make it work with Maven.
"svn status" or "svn up" are easy to verify, but don't always require 
credentials (depends how the access is controlled by the svn server) "svn 
commit" does require authentication.

How credentials are stored: that's all up the the svn client.

thanks,
Robert

Op Fri, 27 Mar 2015 10:35:51 +0100 schreef Sebastian Oerding
:

> Hi Robert,
>
> - I have looked at the Maven SCM project but do not get my problem 
> solved or more hints on it
> - The maven-release-plugin is locked (with version 2.5, not 2.5.1)
> - If running maven with -X according to console no credentials are 
> provided when accessing the SVN
> - If running maven with -Dusername / -Dpassword the credentials are 
> shown (password masked) and it works, however changing the password at 
> least monthly for each run configuration / bat file / ... is no real 
> solution
> - My colleagues encounter the same problem having switched to SVN 1.8
> - How can I get a JIRA account to report a bug?
> - I know that SVN really changes from 1.6 to 1.8, maybe this problem 
> stems from there?
> - I read that  the order of authentication mechanism changes, however 
> trying parameter -Dsvnkit.http.methods=Basic,Digest,Negotiate,NTLM did 
> not help
> - Does the maven-scm-plugin should be able to access SVN with Windows 
> 7
> + Active Directory by using the system's Kerberos / NTLM ticket or was
> there any desupport of this feature?
> - I also had the problem after the last password change but somehow 
> managed it by doing a single commit with Tortoise, saving the 
> credentials (deleting %USER%\AppData\Roaming\Subversion\auth before).
> Afterwards the maven-release worked as expected. Unfortunately this 
> approach seems to work no more. Hence how can I check where are the 
> credentials taken from? Is there some additional kind of extreme 
> logging besides -e / -X switches?
>
> Thanks in advance,
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Robert Scholte [mailto:rfscho...@apache.org]
> Gesendet: Freitag, 27. März 2015 08:51
> An: Maven Users List
> Betreff: Re: maven-release-plugin / SVN credentials
>
> Hi Sebastian,
>
> since your issue has to do with svn, one needs to look at the Maven 
> SCM project.[1] That's what the maven-release-plugin is using to the 
> commits, tags and checkouts.
> First ensure you've locked the version of the maven-release-plugin, 
> preferably the lastest (i.e. 2.5.1).
> If you run the plugin with logging level set to debug (by adding the 
> -X
> argument) you'll see the commandline
> which is executed. You should be able to do the same (do strip off the 
> cmdshell specific part). That should give you the same exception and 
> might give you a hint how this could be fixed.
>
> Verify if it is a knows issue in Jira[2], sometimes such issues give 
> extra info.
>
> Verify the SCM Subversion page[3], it also describes some additional 
> configuration.
>
> If this can't be solved by commandline, then there's a svnjava 
> implementation which you could use[4].
>
> thanks,
> Robert
>
> [1] http://maven.apache.org/scm/maven-scm-providers/index.html
> [2] http://jira.codehaus.org/browse/SCM/component/11191
> [3] http://maven.apache.org/scm/subversion.html
> [4]
> https://code.google.com/a/apache-extras.org/p/maven-scm-provider-svnja
> va/wiki/Usage
>
> Op Thu, 26 Mar 2015 08:20:31 +0100 schreef Sebastian Oerding
> :
>
>> Hello,
>>
>> I have a problem with the maven-release-plugin using the SVN 
>> credentials (details below). I always get an SVN authorization error.
>> It seems that the release plugin does not use the existing 
>> credentials. Unfortunately I'm even not sure whether it is a problem 
>> of the maven-release-pl

Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Lin Ma
Thanks Sebastian,

1. I am using JDK 1.7/1.8 for both development and deployment in runtime,
shall I change 1.5 of source and target to 1.7/1.8?

2. In your example, "for example you can write source code using a JDK 1.6
which is compliant to Java 1.5. However you can also use the StringBuilder
class which does not exist in Java 1.5", I think using JDK 1.6 specific
feature but using 1.5 complier will fail? No? Please feel free to correct
me.

regards,
Lin

On Mon, Mar 30, 2015 at 12:14 AM, Sebastian Oerding <
sebastian.oerd...@robotron.de> wrote:

> source -> The level (JDK version) to which the source code must be
> compliant to, for example you can write source code using a JDK 1.6 which
> is compliant to Java 1.5. However you can also use the StringBuilder class
> which does not exist in Java 1.5
> target -> The class version of the generated class files. The class format
> changes with some Java version, for example as some stuff may be added for
> performance reason. For example if a new byte code instruction comes up
> (like 'invokedynamic') this really makes a change. Or another example (I'm
> not really sure about it): As far as I think a stack map has been added
> from Java 5 to Java 1.6. This should improve performance and makes subtle
> differences when ClassNotFoundException are thrown. You can use a JDK to
> compile code for different but lower versions. This way can benefit from
> some optimizations which weren't available with the old JDK and are
> compatible.
>
> With regards
> Sebastian
>
> -Ursprüngliche Nachricht-
> Von: Lin Ma [mailto:lin...@gmail.com]
> Gesendet: Montag, 30. März 2015 07:46
> An: Maven Users List
> Betreff: about source and target in maven-compiler-plugin
>
> Hello Maven masters,
>
> For maven-compiler-plugin(a sample below), have a quick question. I read
> this document (http://maven.apache.org/plugins/maven-compiler-plugin/),
> and confused what means source and target 1.5 here, it seems it is an
> internal version number of Maven, independent of JDK?
>
> 
> maven-compiler-plugin
> 2.3.2
> 
> 1.5
> 1.5
> 
> 
>
> thanks in advance,
> Lin
>
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>


AW: about source and target in maven-compiler-plugin

2015-03-30 Thread Sebastian Oerding
source -> The level (JDK version) to which the source code must be compliant 
to, for example you can write source code using a JDK 1.6 which is compliant to 
Java 1.5. However you can also use the StringBuilder class which does not exist 
in Java 1.5
target -> The class version of the generated class files. The class format 
changes with some Java version, for example as some stuff may be added for 
performance reason. For example if a new byte code instruction comes up (like 
'invokedynamic') this really makes a change. Or another example (I'm not really 
sure about it): As far as I think a stack map has been added from Java 5 to 
Java 1.6. This should improve performance and makes subtle differences when 
ClassNotFoundException are thrown. You can use a JDK to compile code for 
different but lower versions. This way can benefit from some optimizations 
which weren't available with the old JDK and are compatible.

With regards
Sebastian

-Ursprüngliche Nachricht-
Von: Lin Ma [mailto:lin...@gmail.com] 
Gesendet: Montag, 30. März 2015 07:46
An: Maven Users List
Betreff: about source and target in maven-compiler-plugin

Hello Maven masters,

For maven-compiler-plugin(a sample below), have a quick question. I read this 
document (http://maven.apache.org/plugins/maven-compiler-plugin/), and confused 
what means source and target 1.5 here, it seems it is an internal version 
number of Maven, independent of JDK?


maven-compiler-plugin
2.3.2

1.5
1.5



thanks in advance,
Lin

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


Re: about source and target in maven-compiler-plugin

2015-03-30 Thread Lin Ma
Thanks Olivier,

I am using JDK 1.8 for development and shall I change source and target to
1.8? I think the most popular version of Java are 1.7 or 1.8, not sure why
Maven makes 1.5 as default?

regards,
Lin

On Sun, Mar 29, 2015 at 10:53 PM, Olivier Lamy  wrote:

> On 30 March 2015 at 16:46, Lin Ma  wrote:
>
> > Hello Maven masters,
> >
> > For maven-compiler-plugin(a sample below), have a quick question. I read
> > this document (http://maven.apache.org/plugins/maven-compiler-plugin/),
> > and
> > confused what means source and target 1.5 here, it seems it is an
> internal
> > version number of Maven, independent of JDK?
> >
>
> No. You should read here
>
> http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#source
> .
> Linked to
>
> http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html#options
> see source and target options
>
> HTH
> Olivier
>
>
>
> >
> > 
> > maven-compiler-plugin
> > 2.3.2
> > 
> > 1.5
> > 1.5
> > 
> > 
> >
> > thanks in advance,
> > Lin
> >
>
>
>
> --
> Olivier Lamy
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>