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? > > <plugin> > <artifactId>maven-compiler-plugin</artifactId> > <version>2.3.2</version> > <configuration> > <source>1.5</source> > <target>1.5</target> > </configuration> > </plugin> > > 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