Re: build maven project without setting compiler source and target
Hi Matt, > So I guess it's an issue with NetBeans then a) using such an old version > of maven b) not handle compiler version and minium required > source/target correctly. > Guess I just set it to 8, as that's the oldest jdk/vm I still have lay > around, and don't bother anymore about it. > Thanks for your replies and time anyway. Normally an IDE should respect what you have configured in your pom.xml when you execute a Maven build. Therefore I still assume that you don’t have specified what exact version of m-compiler-p you’d like to use. And that you don’t have configured source and target in m-compiler-p, i.e. you use the default parameters which - according to your mail - are an older version of Maven‘s compiler plugin and/or no source/target version set. Can you show us a minimal sample? Regards Thorsten - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: build maven project without setting compiler source and target
So I guess it's an issue with NetBeans then a) using such an old version of maven b) not handle compiler version and minium required source/target correctly. Guess I just set it to 8, as that's the oldest jdk/vm I still have lay around, and don't bother anymore about it. Thanks for your replies and time anyway. Matt Am 2020-02-17 13:03, schrieb Thorsten Heit: Hi, Scanning for projects... (...) - COMPILATION ERROR : - Source option 5 is no longer supported. Use 6 or later. Target option 1.5 is no longer supported. Use 1.6 or later. 2 errors - You obviously use an older version of maven-compiler-plugin that still defaults to Java 5. In that case this error is expectable as Java 11 doesn't support compiling for Java 5 anymore. The actual version 3.8.1 of m-compiler-p (see [1]) defaults to Java 6 as source and target for the compiler. I suggest you upgrade your pom.xml to that version. Anyway, I recommend you pin the version of each used plugin in your pom.xml. Otherwise you may get different results if you upgrade Maven, the JVM, use another OS and so on. [1] https://maven.apache.org/plugins/maven-compiler-plugin/ Regards Thorsten Am 2020-02-17 13:01, schrieb Thomas Broyer: You seem to mistake the version of the JDK you're using with the version of the Java language that your source files are written in and the JRE they depend on (in terms of available API). You can very well compile Java 8 sources with a JDK 11 or 13. If you share your project between machines where you don't control the JDK, then you'll want to make sure you never use something in your code that won't be available in another machine, so you'll actually *want* to set a source value (for example, you work on a machine with JDK 11 and start using Optional#isEmpty; then switch to a machine with JDK 8, your code won't compile) So: - set a source/target value to the minimum version of the JDK you want to support (if you have machines with JDK 8, then use source=8) - optional but recommended: use 'release' rather than 'source' (if you'll only ever have JDK 9+, then just use 'release'; if you'll have JDK 8, then you'll need to setup a profile to only use 'release' on JDK 9+, and use 'source' otherwise); this will make sure that not only you won't ever use language constructs from newer Java versions (e.g. private methods in interfaces) but will also validate that you won't attempt to use an API that's not available in that version (as in the Optional#isEmpty example above) On Mon, Feb 17, 2020 at 12:46 PM wrote: Sorry for the late reply, but I did some testing to make sure it wasn't me made a stupid mistake. So, when I clone my current repo and execute an "mvn compile" or "mvn package" on it without messing around with the pom either all works fine or I get a failure because the set version is higher than what'S available on the current system. If I manual change the version to match what the system has installed all works fine again (terminal and Netbeans). But when I remove the source and target from the pom I get this error (same when using a terminal as when using Netbeans): cd C:\Users\Administrator\Documents\NetBeansProjects\YouTubeLiveChat; "JAVA_HOME=C:\\Program Files\\AdoptOpenJDK\\jdk-11.0.4.11-hotspot" cmd /c "\"\"C:\\Program Files\\NetBeans-11.2\\netbeans\\java\\maven\\bin\\mvn.cmd\" -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans-11.2\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 install\"" Scanning for projects... Building YouTubeLiveChat 1.0 --- maven-resources-plugin:2.6:resources (default-resources) @ YouTubeLiveChat --- Using 'UTF-8' encoding to copy filtered resources. skip non existing resourceDirectory C:\Users\Administrator\Documents\NetBeansProjects\YouTubeLiveChat\src\main\resources --- maven-compiler-plugin:3.1:compile (default-compile) @ YouTubeLiveChat --- Changes detected - recompiling the module! Compiling 4 source files to C:\Users\Administrator\Documents\NetBeansProjects\YouTubeLiveChat\target\classes - COMPILATION ERROR : - Source option 5 is no longer supported. Use 6 or later. Target option 1.5 is no longer supported. Use 1.6 or later. 2 errors - BUILD FAILURE Total time: 1.995 s Finished at: 2020-02-17T12:28:58+01:00 Final Memory: 10M/40M --
Re: Re: build maven project without setting compiler source and target
Hi, > Scanning for projects... (...) > - > COMPILATION ERROR : > - > Source option 5 is no longer supported. Use 6 or later. > Target option 1.5 is no longer supported. Use 1.6 or later. > 2 errors > - You obviously use an older version of maven-compiler-plugin that still defaults to Java 5. In that case this error is expectable as Java 11 doesn't support compiling for Java 5 anymore. The actual version 3.8.1 of m-compiler-p (see [1]) defaults to Java 6 as source and target for the compiler. I suggest you upgrade your pom.xml to that version. Anyway, I recommend you pin the version of each used plugin in your pom.xml. Otherwise you may get different results if you upgrade Maven, the JVM, use another OS and so on. [1] https://maven.apache.org/plugins/maven-compiler-plugin/ Regards Thorsten
Re: build maven project without setting compiler source and target
You seem to mistake the version of the JDK you're using with the version of the Java language that your source files are written in and the JRE they depend on (in terms of available API). You can very well compile Java 8 sources with a JDK 11 or 13. If you share your project between machines where you don't control the JDK, then you'll want to make sure you never use something in your code that won't be available in another machine, so you'll actually *want* to set a source value (for example, you work on a machine with JDK 11 and start using Optional#isEmpty; then switch to a machine with JDK 8, your code won't compile) So: - set a source/target value to the minimum version of the JDK you want to support (if you have machines with JDK 8, then use source=8) - optional but recommended: use 'release' rather than 'source' (if you'll only ever have JDK 9+, then just use 'release'; if you'll have JDK 8, then you'll need to setup a profile to only use 'release' on JDK 9+, and use 'source' otherwise); this will make sure that not only you won't ever use language constructs from newer Java versions (e.g. private methods in interfaces) but will also validate that you won't attempt to use an API that's not available in that version (as in the Optional#isEmpty example above) On Mon, Feb 17, 2020 at 12:46 PM wrote: > Sorry for the late reply, but I did some testing to make sure it wasn't > me made a stupid mistake. > So, when I clone my current repo and execute an "mvn compile" or "mvn > package" on it without messing around with the pom either all works fine > or I get a failure because the set version is higher than what'S > available on the current system. If I manual change the version to match > what the system has installed all works fine again (terminal and > Netbeans). > But when I remove the source and target from the pom I get this error > (same when using a terminal as when using Netbeans): > > cd C:\Users\Administrator\Documents\NetBeansProjects\YouTubeLiveChat; > "JAVA_HOME=C:\\Program Files\\AdoptOpenJDK\\jdk-11.0.4.11-hotspot" cmd > /c "\"\"C:\\Program > Files\\NetBeans-11.2\\netbeans\\java\\maven\\bin\\mvn.cmd\" > -Dmaven.ext.class.path=\"C:\\Program > Files\\NetBeans-11.2\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" > -Dfile.encoding=UTF-8 install\"" > Scanning for projects... > > > Building YouTubeLiveChat 1.0 > > > --- maven-resources-plugin:2.6:resources (default-resources) @ > YouTubeLiveChat --- > Using 'UTF-8' encoding to copy filtered resources. > skip non existing resourceDirectory > > C:\Users\Administrator\Documents\NetBeansProjects\YouTubeLiveChat\src\main\resources > > --- maven-compiler-plugin:3.1:compile (default-compile) @ > YouTubeLiveChat --- > Changes detected - recompiling the module! > Compiling 4 source files to > > C:\Users\Administrator\Documents\NetBeansProjects\YouTubeLiveChat\target\classes > - > COMPILATION ERROR : > - > Source option 5 is no longer supported. Use 6 or later. > Target option 1.5 is no longer supported. Use 1.6 or later. > 2 errors > - > > BUILD FAILURE > > Total time: 1.995 s > Finished at: 2020-02-17T12:28:58+01:00 > Final Memory: 10M/40M > > Failed to execute goal > org.apache.maven.plugins:maven-compiler-plugin:3.1:compile > (default-compile) on project YouTubeLiveChat: Compilation failure: > Compilation failure: > Source option 5 is no longer supported. Use 6 or later. > Target option 1.5 is no longer supported. Use 1.6 or later. > -> [Help 1] > > To see the full stack trace of the errors, re-run Maven with the -e > switch. > Re-run Maven using the -X switch to enable full debug logging. > > For more information about the errors and possible solutions, please > read the following articles: > [Help 1] > http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException > > From what I was able to find this is because the hardcoded default value > wich is used when no other setting is found in pom in the compiler > plugin is version 5. As the error message says, this is no longer > supported and 6 or higher should be used. I didn'T filed a bug report > cause it's possible that there're version mismatches wich may cause this > - I'm not sure about that. > So, as I don't want to set a fixed value (maybe would be 8 if I have to) > I would rather prefer to disable this settings at all and just let it > compile with what ever version the system has a JDK of. Or, if it's not > po
Re: build maven project without setting compiler source and target
Sorry for the late reply, but I did some testing to make sure it wasn't me made a stupid mistake. So, when I clone my current repo and execute an "mvn compile" or "mvn package" on it without messing around with the pom either all works fine or I get a failure because the set version is higher than what'S available on the current system. If I manual change the version to match what the system has installed all works fine again (terminal and Netbeans). But when I remove the source and target from the pom I get this error (same when using a terminal as when using Netbeans): cd C:\Users\Administrator\Documents\NetBeansProjects\YouTubeLiveChat; "JAVA_HOME=C:\\Program Files\\AdoptOpenJDK\\jdk-11.0.4.11-hotspot" cmd /c "\"\"C:\\Program Files\\NetBeans-11.2\\netbeans\\java\\maven\\bin\\mvn.cmd\" -Dmaven.ext.class.path=\"C:\\Program Files\\NetBeans-11.2\\netbeans\\java\\maven-nblib\\netbeans-eventspy.jar\" -Dfile.encoding=UTF-8 install\"" Scanning for projects... Building YouTubeLiveChat 1.0 --- maven-resources-plugin:2.6:resources (default-resources) @ YouTubeLiveChat --- Using 'UTF-8' encoding to copy filtered resources. skip non existing resourceDirectory C:\Users\Administrator\Documents\NetBeansProjects\YouTubeLiveChat\src\main\resources --- maven-compiler-plugin:3.1:compile (default-compile) @ YouTubeLiveChat --- Changes detected - recompiling the module! Compiling 4 source files to C:\Users\Administrator\Documents\NetBeansProjects\YouTubeLiveChat\target\classes - COMPILATION ERROR : - Source option 5 is no longer supported. Use 6 or later. Target option 1.5 is no longer supported. Use 1.6 or later. 2 errors - BUILD FAILURE Total time: 1.995 s Finished at: 2020-02-17T12:28:58+01:00 Final Memory: 10M/40M Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project YouTubeLiveChat: Compilation failure: Compilation failure: Source option 5 is no longer supported. Use 6 or later. Target option 1.5 is no longer supported. Use 1.6 or later. -> [Help 1] To see the full stack trace of the errors, re-run Maven with the -e switch. Re-run Maven using the -X switch to enable full debug logging. For more information about the errors and possible solutions, please read the following articles: [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException From what I was able to find this is because the hardcoded default value wich is used when no other setting is found in pom in the compiler plugin is version 5. As the error message says, this is no longer supported and 6 or higher should be used. I didn'T filed a bug report cause it's possible that there're version mismatches wich may cause this - I'm not sure about that. So, as I don't want to set a fixed value (maybe would be 8 if I have to) I would rather prefer to disable this settings at all and just let it compile with what ever version the system has a JDK of. Or, if it's not possible to complete throw it out is there at least a way to not just set a specific version but rather only a minimum? So, that a system wich has only J8 can use this, but other system with 9, 11, 13 won'T be enforced to compile v8 but with their own version? As I also mentioned else where: I thought IDEs and all their build stuff is supposed to make developing easier - but I had so many issues I encountered since I started to use it a few days ago I really though of go back to basic editor and terminal - wich seems easier (side-note about dependency management: yes, sure, it's nice to have a build system handle it for you, but as I'm used to gather libs and dependencies myself, and many often come in bundles, and manage different and matching versions by myself, I got a rather big lib collection used by just point my system wide classpath to the lib directory). So, any thoughts about how to solve that issue? I'm honestly kind of lost, not just using Netbeans as a gui wrapper (as one of its devs called it on their list) but also get my head around maven as the build environment). Thanks for any help in advance, Matt Am 2020-02-17 05:24, schrieb Bernd Eckenfels: Can you show the actual error message and give a concrete project? Normally Maven works with not specifying target/source as long as your JDK is recent enough. (But it's not ways a good idea, it's better to specify the properties (IDEs normally read them) -- http://b
Re: build maven project without setting compiler source and target
Can you show the actual error message and give a concrete project? Normally Maven works with not specifying target/source as long as your JDK is recent enough. (But it's not ways a good idea, it's better to specify the properties (IDEs normally read them) -- http://bernd.eckenfels.net Von: java-cry...@cryptearth.de Gesendet: Monday, February 17, 2020 4:27:16 AM An: users@maven.apache.org Betreff: build maven project without setting compiler source and target So as I just got new into using Netbeans someone on its list explained me, that it's just a gui wrapper around maven and it's adviced to get the basics of maven to correctly use netbeans. Ok, so as I just used a simple editor and a terminal it didn't mattered wich version I compiled with or for in the past as I ran the class with the same vm I compiled them with. So, the I thought I could just ommit the setting - but maven just fails with an error that no source/target version was specified. So I had them re-add by re-apply the project settings. Is there a way I could tell the compiler plugin just to ignore the version but also to ignore if it's missing and just compile it with whatever version I ran maven with? It's basically: I use different systems all with different jdk installed - so when just clone the most recent version from github I always have to set the correct version manual as netbeans doesn't seem to be handle that by itself - and I could find an option to just get rid of it at all. Thanks in advance, Matt - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: build maven offline
> No, if you want to bootstrap then you have to be online in order to get > any missing dependencies the first time. After you have them all you can > bootstrap offline if you wish. Of course but did I have to copy them in ${basedir}/lib or did I have to create the ~/.maven/repository by hand ? Nicolas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: build maven offline
On Tue, 2003-12-16 at 08:59, [EMAIL PROTECTED] wrote: > I try to install maven from the cvs src. The computer has no acces to > internet. My problem is that ant -f build-boostrap.xml try to download > dependencies from ibiblio. > Is there a way to use a local directory during my first maven installation > ? Or an other install methods ? No, if you want to bootstrap then you have to be online in order to get any missing dependencies the first time. After you have them all you can bootstrap offline if you wish. > Nicolas, > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- jvz. Jason van Zyl [EMAIL PROTECTED] http://tambora.zenplex.org In short, man creates for himself a new religion of a rational and technical order to justify his work and to be justified in it. -- Jacques Ellul, The Technological Society - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: build maven
While this may sound like a good idea, consider that the repository is currently 325M and contains a lot of stuff that you will never use. It would only be of real use if you were going offline for a long period of time and might need a whole lot of odd versions. Moretti, Luciano (MED) wrote: David- I don't know of it, and can't find it in my list of goals, but I am a Newbie... If you're under linux/unix I'd probably use wget to handle that. wget is really well designed to get recursive online filesystems and copy them to the local filesystem. after a little experimenting on our local repo, (as wget can't go through my proxy as it's currently configured) if you're going to try it, I'd suggest trying to use the FTP functionality, as the HTTP version generates a bunch of junk files that are created by apache (index files & graphics). Using my local repo instead of ibiblio's, here's what I came up with- Execute it from $MAVEN_HOME wget -r -nH ftp://ibiblio.org/maven -r =Recursively navigate the tree -nH=No Home- by default it'll create a directory ibiblio.org and put all the files in there.. this is not what you want. You may have to tweak the ftp statement, as I can't see what ibiblio's dir structure looks like from inside the proxy- which means you might have to add the --cut-dirs= statement to get rid of junk directories. This should create a mirror of the remote repo with in the $MAVEN_HOME/maven dir. Inspect the new repo to make sure it looks good, then use the mv command to move it to $MAVEN_HOME/repository. I'd personally suggest backing up the old repo if one exists, as I've ran into problems when completely overwriting the local repo. Good Luck- I'm pretty new at this, so this is use at your own risk, Luciano -Original Message- From: David Liles [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 4:54 PM To: Maven Users List Subject: RE: build maven I was under the impression that there was a generic call that could be made that basically downloads all of the available jars and places them in the repository strucuture. -Original Message- From: Moretti, Luciano (MED) [mailto:[EMAIL PROTECTED] Sent: Tue 7/1/2003 4:47 PM To: 'Maven Users List' Cc: Subject: RE: build maven Dave- Maven will automatically generate the repository on the 1st run. There is no specific step needed to build a local repository- it will fetch the needed jars off the web when they are called for. Just create your project.properties file, make sure that you have the proxy configuration stuff if you need it, and go ahead and start defining & building your project. It's one of the coolest things about maven that I've run into so far. Have fun, Luciano -Original Message- From: David Liles [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 4:29 PM To: [EMAIL PROTECTED] Subject: build maven I just downloaded and installed maven 1.0 b9. What is the syntax I need to use to begin the process to have maven generate all of the repository jar files? - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: build maven
David- I don't know of it, and can't find it in my list of goals, but I am a Newbie... If you're under linux/unix I'd probably use wget to handle that. wget is really well designed to get recursive online filesystems and copy them to the local filesystem. after a little experimenting on our local repo, (as wget can't go through my proxy as it's currently configured) if you're going to try it, I'd suggest trying to use the FTP functionality, as the HTTP version generates a bunch of junk files that are created by apache (index files & graphics). Using my local repo instead of ibiblio's, here's what I came up with- Execute it from $MAVEN_HOME wget -r -nH ftp://ibiblio.org/maven -r =Recursively navigate the tree -nH=No Home- by default it'll create a directory ibiblio.org and put all the files in there.. this is not what you want. You may have to tweak the ftp statement, as I can't see what ibiblio's dir structure looks like from inside the proxy- which means you might have to add the --cut-dirs= statement to get rid of junk directories. This should create a mirror of the remote repo with in the $MAVEN_HOME/maven dir. Inspect the new repo to make sure it looks good, then use the mv command to move it to $MAVEN_HOME/repository. I'd personally suggest backing up the old repo if one exists, as I've ran into problems when completely overwriting the local repo. Good Luck- I'm pretty new at this, so this is use at your own risk, Luciano -Original Message- From: David Liles [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 4:54 PM To: Maven Users List Subject: RE: build maven I was under the impression that there was a generic call that could be made that basically downloads all of the available jars and places them in the repository strucuture. -Original Message- From: Moretti, Luciano (MED) [mailto:[EMAIL PROTECTED] Sent: Tue 7/1/2003 4:47 PM To: 'Maven Users List' Cc: Subject: RE: build maven Dave- Maven will automatically generate the repository on the 1st run. There is no specific step needed to build a local repository- it will fetch the needed jars off the web when they are called for. Just create your project.properties file, make sure that you have the proxy configuration stuff if you need it, and go ahead and start defining & building your project. It's one of the coolest things about maven that I've run into so far. Have fun, Luciano -Original Message- From: David Liles [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 4:29 PM To: [EMAIL PROTECTED] Subject: build maven I just downloaded and installed maven 1.0 b9. What is the syntax I need to use to begin the process to have maven generate all of the repository jar files? - 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]
RE: build maven
I was under the impression that there was a generic call that could be made that basically downloads all of the available jars and places them in the repository strucuture. -Original Message- From: Moretti, Luciano (MED) [mailto:[EMAIL PROTECTED] Sent: Tue 7/1/2003 4:47 PM To: 'Maven Users List' Cc: Subject: RE: build maven Dave- Maven will automatically generate the repository on the 1st run. There is no specific step needed to build a local repository- it will fetch the needed jars off the web when they are called for. Just create your project.properties file, make sure that you have the proxy configuration stuff if you need it, and go ahead and start defining & building your project. It's one of the coolest things about maven that I've run into so far. Have fun, Luciano -Original Message- From: David Liles [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 4:29 PM To: [EMAIL PROTECTED] Subject: build maven I just downloaded and installed maven 1.0 b9. What is the syntax I need to use to begin the process to have maven generate all of the repository jar files? - 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]
RE: build maven
Dave- Maven will automatically generate the repository on the 1st run. There is no specific step needed to build a local repository- it will fetch the needed jars off the web when they are called for. Just create your project.properties file, make sure that you have the proxy configuration stuff if you need it, and go ahead and start defining & building your project. It's one of the coolest things about maven that I've run into so far. Have fun, Luciano -Original Message- From: David Liles [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 01, 2003 4:29 PM To: [EMAIL PROTECTED] Subject: build maven I just downloaded and installed maven 1.0 b9. What is the syntax I need to use to begin the process to have maven generate all of the repository jar files? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]