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://bernd.eckenfels.net
________________________________
Von: [email protected] <[email protected]>
Gesendet: Monday, February 17, 2020 4:27:16 AM
An: [email protected] <[email protected]>
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: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]