Hello, Using the command: mvn -Dmaven.compiler.target=1.6 package
...produced what I was looking for, classfiles with version 50. Thanks, Christopher On 1 October 2013 18:42, sebb <[email protected]> wrote: > On 1 October 2013 16:36, Christopher BROWN <[email protected]> wrote: > > Thanks for the link Oleg. Having followed it, and not being an avid > Maven > > user, I assume that I need to add something like this: > > > > <properties> > > <maven.compiler.source>1.5</maven.compiler.source> > > <maven.compiler.target>1.6</maven.compiler.target> > > </properties> > > > > => (changing "maven.compiler.target" to "1.6"), just before the closing > > </project> tag in the "pom.xml" file at the top of the "src" package. > > Which should in turn cascade (effectively, not physically by copying) > into > > the POMs in the subfolders, such as "httpcore", "httpcore-nio", I expect. > > Is this correct? > > That is the correct way to define properties. > You can also define them on the command line: > > mvn -Dmaven.compiler.target=1.6 package > > Note that those properties only affect the -source and -target options > that are passed to the compiler. > > > Sorry for the "theoretical" answer, I will try it when I can (I can't > right > > now), was just wondering if I was on the right track... > > > > -- > > Christopher > > > > > > > > > > On 1 October 2013 16:41, Oleg Kalnichevski <[email protected]> wrote: > > > >> On Tue, 2013-10-01 at 06:48 +0200, Christopher BROWN wrote: > >> > Hi, > >> > > >> > More of an Ant user, I tried configuring the POM file after > downloading > >> > http "core" (haven't tried "client" yet) to compile to Java 1.6, for a > >> more > >> > recent classfile format (it's slightly more efficient). > >> > > >> > I tried to follow advice here: > >> > > >> > http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html > >> > > >> > ...but couldn't see any references to maven-compiler-plugin in any of > the > >> > pom.xml files (including those in subdirectories). > >> > > >> > There seems to be some magic going on, as I tried compiling anyway, > and > >> > after inspecting the generated classes in the generated jars ("mvn > >> install" > >> > was successful), it appears that the output classfile version is 49 > (as > >> in > >> > Java 5)... I checked as follows: > >> > javap -v org.apache.http.util.VersionInfo > >> > > >> > I said "magic", because I'm using Mac OS X 10.8 from 2012 with only > Java > >> 6, > >> > 7, and 8 installed... > >> > > >> > I'm curious to know how Java 5 is specified and used for compilation, > and > >> > would like to compile with the most recent "javac" version possible. > >> > > >> > Thanks, > >> > Christopher > >> > >> The usual delights of dealing with complex build systems. I think the > >> default compiler target and source levels are defined in the parent POM: > >> > >> > >> > http://search.maven.org/remotecontent?filepath=org/apache/httpcomponents/project/7/project-7.pom > >> > >> One should be able to override them at individual POM level, though. > >> > >> Oleg > >> > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
