yes, it can be switched with alternatives:
$ sudo alternatives --config java
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 java-latest-openjdk.x86_64
(/usr/lib/jvm/java-14-openjdk-14.0.2.12-1.rolling.fc32.x86_64/bin/java)
* 2 java-1.8.0-openjdk.x86_64
(/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.265.b01-1.fc32.x86_64/jre/bin/java)
+ 3 java-11-openjdk.x86_64
(/usr/lib/jvm/java-11-openjdk-11.0.8.10-2.fc32.x86_64/bin/java)
Same for `javac`
And JAVA_HOME needs to be set to `/usr/lib/jvm/java-1.8.0-openjdk` (or
whatever the path is for JDK 8),
`mvn -v` can be used to check if it points to the right version
On Wed, Sep 16, 2020 at 1:48 PM Nir Soffer <nsoffer(a)redhat.com> wrote:
On Wed, Sep 16, 2020 at 1:45 PM Benny Zlotnik <bzlotnik(a)redhat.com> wrote:
>
> api-model can only be built with java 8 currently,
It is possible to install both java 8 and 11 and use 8 for the api model?
> there is a patch to
> upgrade to java 11[1], but it's not merged yet
>
> [1]
https://gerrit.ovirt.org/#/c/111106/
>
> On Wed, Sep 16, 2020 at 1:42 PM Nir Soffer <nsoffer(a)redhat.com> wrote:
> >
> > I'm trying to build with this change:
> >
https://gerrit.ovirt.org/c/111312/
> >
> > And it fails to build. Same error on master
> > (commit 2e3c836e4c2fd50258e96bc6966b5d9680b5332e).
> >
> > Anyone has a clue what is the reason for this? any workaround?
> >
> > $ mvn clean install
> > [INFO] Scanning for projects...
> > [INFO]
> > [INFO] ---------------------< org.ovirt.engine.api:model
>---------------------
> > [INFO] Building oVirt API Model 4.4.18-SNAPSHOT
> > [INFO] --------------------------------[ jar
]---------------------------------
> > [INFO]
> > [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ model ---
> > [INFO] Deleting /home/nsoffer/src/ovirt-engine-api-model/target
> > [INFO]
> > [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ model
---
> > [INFO] Using 'UTF-8' encoding to copy filtered resources.
> > [INFO] skip non existing resourceDirectory
> > /home/nsoffer/src/ovirt-engine-api-model/src/main/resources
> > [INFO]
> > [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ model ---
> > [INFO] Changes detected - recompiling the module!
> > [INFO] Compiling 601 source files to
> > /home/nsoffer/src/ovirt-engine-api-model/target/classes
> > [WARNING]
/home/nsoffer/src/ovirt-engine-api-model/src/main/java/services/DisksService.java:
> > Some input files use or override a deprecated API.
> > [WARNING]
/home/nsoffer/src/ovirt-engine-api-model/src/main/java/services/DisksService.java:
> > Recompile with -Xlint:deprecation for details.
> > [INFO]
> > [INFO] --- exec-maven-plugin:1.4.0:java (generate-doc) @ model ---
> > SLF4J: Class path contains multiple SLF4J bindings.
> > SLF4J: Found binding in
> >
[jar:file:/home/nsoffer/.m2/repository/org/slf4j/slf4j-log4j12/1.7.7/slf4j-log4j12-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> > SLF4J: Found binding in
> >
[jar:file:/home/nsoffer/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
> > SLF4J: See
http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
> > SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
> > WARNING: An illegal reflective access operation has occurred
> > WARNING: Illegal reflective access by
> > org.jboss.classfilewriter.ClassFile$1
> >
(file:/home/nsoffer/.m2/repository/org/jboss/weld/se/weld-se/2.3.0.Final/weld-se-2.3.0.Final.jar)
> > to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
> > WARNING: Please consider reporting this to the maintainers of
> > org.jboss.classfilewriter.ClassFile$1
> > WARNING: Use --illegal-access=warn to enable warnings of further
> > illegal reflective access operations
> > WARNING: All illegal access operations will be denied in a future release
> > ERROR org.ovirt.api.metamodel.tool.Main - Error while executing the
> > "run" method of tool class
"org.ovirt.api.metamodel.tool.Tool".
> > java.lang.reflect.InvocationTargetException
> > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> > at org.ovirt.api.metamodel.tool.Main.main(Main.java:74)
> > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> > at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
> > at java.base/java.lang.Thread.run(Thread.java:834)
> > Caused by: org.jboss.weld.exceptions.WeldException: WELD-000049:
> > Unable to invoke public void
> > org.ovirt.api.metamodel.tool.AsciiDocHtmlGenerator.init() on
> > org.ovirt.api.metamodel.tool.AsciiDocHtmlGenerator@6ef4091
> > at
org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:100)
> > at
org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.postConstruct(DefaultLifecycleCallbackInvoker.java:81)
> > at
org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(BasicInjectionTarget.java:126)
> > at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:171)
> > at
org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:70)
> > at
org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
> > at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
> > at
org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:742)
> > at
org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:842)
> > at
org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
> > at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:378)
> > at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:389)
> > at
org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
> > at
org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
> > at
org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
> > at
org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
> > at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
> > at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:96)
> > at
org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
> > at
org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:141)
> > at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
> > at
org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:99)
> > at
org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:125)
> > at
org.ovirt.api.metamodel.tool.XmlDescriptionGenerator$Proxy$_$$_WeldClientProxy.generate(Unknown
> > Source)
> > at org.ovirt.api.metamodel.tool.Tool.run(Tool.java:383)
> > at org.ovirt.api.metamodel.tool.Tool$Proxy$_$$_WeldClientProxy.run(Unknown
> > Source)
> > ... 11 more
> > Caused by: java.lang.reflect.InvocationTargetException
> > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> > at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > at java.base/java.lang.reflect.Method.invoke(Method.java:566)
> > at
org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:98)
> > ... 36 more
> > Caused by: java.lang.ExceptionInInitializerError
> > at
org.asciidoctor.internal.JRubyAsciidoctor.createOptimizedConfiguration(JRubyAsciidoctor.java:151)
> > at
org.asciidoctor.internal.JRubyAsciidoctor.createJRubyAsciidoctorInstance(JRubyAsciidoctor.java:114)
> > at org.asciidoctor.internal.JRubyAsciidoctor.create(JRubyAsciidoctor.java:62)
> > at org.asciidoctor.Asciidoctor$Factory.create(Asciidoctor.java:647)
> > at
org.ovirt.api.metamodel.tool.AsciiDocHtmlGenerator.init(AsciiDocHtmlGenerator.java:39)
> > ... 41 more
> > Caused by: java.lang.RuntimeException: unsupported Java version: 11
> > at
org.jruby.RubyInstanceConfig.initGlobalJavaVersion(RubyInstanceConfig.java:1858)
> > at org.jruby.RubyInstanceConfig.<clinit>(RubyInstanceConfig.java:1608)
> > ... 46 more
> > Weld SE container STATIC_INSTANCE shut down by shutdown hook
> >
>