Re: Resolve root directory in a multi-project build

2021-02-07 Thread Alexander Kriegisch
> I think the reason someone might want their projects all in the same
> directory is because Eclipse has issues with nested project
> structures.

I see how that can be a pain in the ***. I was unaware of this problem,
being an IntelliJ IDEA user.

-- 
Alexander Kriegisch
https://scrum-master.de


Delany schrieb am 07.02.2021 12:19 (GMT +07:00):

> Hopefully our conversation will benefit others who've experienced the same
> issue, so thank you for showing that it works in some cases. I think the
> reason someone might want their projects all in the same directory is
> because Eclipse has issues with nested project structures.
> 
> @Lasse, the directory-of goal of directory-maven-plugin seems even more
> idiot-proof than highest-basedir, so im using that.
> 
> Delany
> 
> On Sun, 7 Feb 2021 at 03:29, Alexander Kriegisch 
> wrote:
> 
>> > It seems the goal assumes that child modules sit in nested
>> > directories.
>>
>> Well, that might be the case. I have never tested any other scenario
>> because this is how I organise my Maven projects. Neither am I a Maven
>> expert nor did I claim that my solution works for everybody in every
>> case. I just read a message on the list, remembered that I used to
>> struggle with a similar problem in the past and offered my solution
>> because it *works for me*. If it does not work for you because your
>> child modules are not in nested directories, I am sorry. I am more the
>> "convention over configuration" type, trying to keep it simple.
>>
>> Regards
>> --
>> Alexander Kriegisch
>> https://scrum-master.de
>>
>>
>> Delany schrieb am 06.02.2021 21:07 (GMT +07:00):
>> >
>> >
>> > It seems the goal assumes that child modules sit in nested directories.
>> >
>> > Unzip and run mvn validate in the root directory, and you'll see the root
>> > location for project sarek is incorrect.
>> >
>> > Delany
>> >
>> >
>> > On Sat, 6 Feb 2021 at 14:28, Alexander Kriegisch <
>> alexan...@kriegisch.name
>> >  > wrote:
>> >
>> >> Maybe I misunderstand you, but for me this works nicely in a module
>> which
>> >> has a parent of type POM which has the root (also of type POM) as
>> parent.
>> >> I.e. the root POM is the grandparent. I have no issues, as long as the
>> >> property is declared in the root as shown in the project I linked to.
>> >> --
>> >> Alexander Kriegisch
>> >> https://scrum-master.de
>> >>
>> >>
>> >> Delany schrieb am 06.02.2021 17:24 (GMT +07:00):
>> >>
>> >> > This only works if the parent is the root. If you extend to a third
>> >> level
>> >> > of pom, it will report the rootlocation as the project directory.
>> >> >
>> >> > On Sat, 6 Feb 2021 at 04:22, Alexander Kriegisch
>> >> > >>  >
>> >> > wrote:
>> >> >
>> >> >> I had some discussion with Karl Heinz Marbaise about
>> >> >> maven.multiModuleProjectDirectory a while ago (cannot remember where
>> >> >> exactly) and he strongly advised me not to use it as it is for
>> >> internal
>> >> >> use only. Even so, other tools such as IntelliJ IDEA use it
>> >> internally,
>> >> >> but not consequently, the situationis a bit messy.
>> >> >>
>> >> >> What I ended up doing was to use Build Helper Maven Plugin >= 3.2.0
>> >> >> (because of
>> >> >>
>> >> https://github.com/mojohaus/build-helper-maven-plugin/issues/48)
>> >> and
>> >> >> there to use the "rootlocation" goal. I am not sure if that is
>> working
>> >> >> for you here because you said you need it somewhere in a plugin and I
>> >> >> just use it in my project's root POM. For IDEA I still need need
>> >> >> "-DprojectRootDir=..." in /.mvn/jvm.config, but from
>> >> the
>> >> >> command line it works, even when building from a module subdirectory.
>> >> >> Here is my POM (just search for the string "rootlocation" there, you
>> >> >> should find 4 places):
>> >> >>
>> >> >> https://github.com/SarekTest/Sarek/blob/master/pom.xml
>> >> >> --
>> >> >> Alexander Kriegisch
>> >> >> https://scrum-master.de
>> >> >>
>> >> >>
>> >> >> Falko Modler schrieb am 06.02.2021 04:35 (GMT +07:00):
>> >> >>
>> >> >> > For me, no problem on Jenkins either (using "withMaven" pipeline
>> >> step).
>> >> >> > There used to be this issue:
>> >> >> https://issues.jenkins.io/browse/JENKINS-35335
>> >> >> > Which turned out to be a Maven bug which was fixed in 3.5.0:
>> >> >> > https://issues.apache.org/jira/browse/MNG-5889
>> >> >> >
>> >> >> > As far as MNG-5830 is concerned, I don't know what (special) setup
>> >> the
>> >> >> > affected people are using.
>> >> >> >
>> >> >> > I can only say/repeat that you need a .mvn directory to have the
>> >> >> > property point to your root directory.
>> >> >> > But even without .mvn, there should not be such an error message,
>> so
>> >> IDK
>> >> >> > what's going on in those cases.
>> >> >> >
>> >> >> > Am 05.02.2021 um 22:13 schrieb Delany:
>> >> >> >> Maybe for you Falko, but not my Jenkins server with Maven 3.6.3,
>> or
>> >> >> these
>> >> >> >> other users
>> >> >> >>
>> >> 

Re: Maven compiler plugin Unsupported major.minor version

2021-02-07 Thread Benjamin Marwell
Hi Andrea,

looking at the maven-compiler-plugin, it uses plexus-java 0.9.10 which
in turn uses an old 6.x asm version.

Try adding a more recent version of plexus-java (which uses asm 9.0)
and see if that works.

org.apache.maven.plugins
maven-compiler-plugin
3.8.1

15

--enable-preview



org.codehaus.plexus
plexus-java
1.0.6



If it works, please kindly open a ticket at
http://issues.apache.org/jira/projects/MCOMPILER with the full stack
trace.

- Ben

Am Sa., 6. Feb. 2021 um 08:47 Uhr schrieb Andrea Vacondio
:
>
> Hi,
> I hope this is the right channel.
> I have a multi module project that I'm trying to modularize in the JPMS
> sense.
> It's configured to run maven with java 11 and run the compiler plugin using
> java 15 through the toolchain plugin and this is what I get:
>
> [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @
> pdfblack-model ---
> [INFO] Toolchain in maven-compiler-plugin: JDK[/usr/lib/jvm/jdk-15.0.1+9]
> [INFO]
> 
> [INFO] BUILD FAILURE
> [INFO]
> 
> [INFO] Total time:  1.141 s
> [INFO] Finished at: 2021-02-05T18:07:26+01:00
> [INFO]
> 
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile
> (default-compile) on project pdfblack-model: Execution default-compile of
> goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed:
> Unsupported major.minor version 59.65535 -> [Help 1]
>
> I attached the full stacktrace at the bottom.
> It seems to me the plugin is using jdk11 to do something where it should
> use jdk15 from the toolchain but before digging deeper I wanted to double
> check if I'm doing anything wrong or if maybe my expectations are wrong.
> This is my configuration, nothing special there:
> 
> org.apache.maven.plugins
> maven-compiler-plugin
> 3.8.1
> 
> 15
> 
> --enable-preview
> 
> 
> 
>
> This is the stacktrace:
> Execution default-compile of goal
> org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed:
> Unsupported major.minor version 59.65535
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:215)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:156)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:148)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:117)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:81)
> at
> org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
> (SingleThreadedBuilder.java:56)
> at org.apache.maven.lifecycle.internal.LifecycleStarter.execute
> (LifecycleStarter.java:128)
> at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
> at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
> at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
> at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
> at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
> at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
> at jdk.internal.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:62)
> at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke (Method.java:566)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced
> (Launcher.java:282)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launch
> (Launcher.java:225)
> at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode
> (Launcher.java:406)
> at org.codehaus.plexus.classworlds.launcher.Launcher.main
> (Launcher.java:347)
> Caused by: org.apache.maven.plugin.PluginExecutionException: Execution
> default-compile of goal
> org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile failed:
> Unsupported major.minor version 59.65535
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo
> (DefaultBuildPluginManager.java:148)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:210)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:156)
> at org.apache.maven.lifecycle.internal.MojoExecutor.execute
> (MojoExecutor.java:148)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
> (LifecycleModuleBuilder.java:117)
> at
> org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject
>