os-xtoo
os-xtoo copied to clipboard
[maven] dev-java/maven: Package cli mvn in meta ebuild
Hi,
how to install maven? I installed maven-core but I cannot access maven via console. Before I used your overlay I used maven-bin.
Thanks, Fionera
I have not finished packing Maven. I packaged pieces of it that I needed for packaging Gradle from source. Which Gradle uses an older version of Maven, and I got stuck updating some stuff in Gradle for newer Maven. Or I have to slot Maven and add an older version. Gradle cli is broken and not exactly sure why. I assume its due to other pieces missing. Like the ones that need the piece of Maven I am stuck on.
I need to look into which part of Maven should provide the cli and add a cli launcher for that. Though maybe some time before that is fully usable in place of a maven-bin package. Right now the maven packages are only usable as libraries. I opened a project to track the status of packaging maven from source, but have made little progress on that.
Moved comment into new issue referenced below
The main one missing for this is maven-embedder. That has the MavenCli. I have a base maven-embedder, but it needs work. Logback is a pain to package. It has groovy and java code, and they mix. I could not figure out how to get it packaged before for jmeter. Now I have no choice for Maven...
org/apache/maven/cli/MavenCli.java:622: error: cannot find symbol
.setRealm( containerRealm ).setClassPathScanning( PlexusConstants.SCANNING_INDEX ).setAutoWiring( true )
^
symbol: variable SCANNING_INDEX
location: class PlexusConstants
org/apache/maven/cli/MavenCli.java:635: error: no suitable constructor found for DefaultPlexusContainer(ContainerConfiguration,<anonymous AbstractModule>)
DefaultPlexusContainer container = new DefaultPlexusContainer( cc, new AbstractModule()
^
constructor DefaultPlexusContainer.DefaultPlexusContainer() is not applicable
(actual and formal argument lists differ in length)
constructor DefaultPlexusContainer.DefaultPlexusContainer(ContainerConfiguration) is not applicable
(actual and formal argument lists differ in length)
org/apache/maven/cli/MavenCli.java:653: error: no suitable method found for discoverComponents(ClassRealm,SessionScopeModule,MojoExecutionScopeModule)
container.discoverComponents( extension.getClassRealm(), new SessionScopeModule( container ),
^
method DefaultPlexusContainer.discoverComponents(ClassRealm) is not applicable
(actual and formal argument lists differ in length)
method DefaultPlexusContainer.discoverComponents(ClassRealm,Object) is not applicable
(actual and formal argument lists differ in length)
org/apache/maven/cli/MavenCli.java:715: error: cannot find symbol
.setClassPathScanning( PlexusConstants.SCANNING_INDEX ) //
^
symbol: variable SCANNING_INDEX
location: class PlexusConstants
org/apache/maven/cli/MavenCli.java:720: error: no suitable constructor found for DefaultPlexusContainer(ContainerConfiguration,<anonymous AbstractModule>)
DefaultPlexusContainer container = new DefaultPlexusContainer( cc, new AbstractModule()
^
constructor DefaultPlexusContainer.DefaultPlexusContainer() is not applicable
(actual and formal argument lists differ in length)
constructor DefaultPlexusContainer.DefaultPlexusContainer(ContainerConfiguration) is not applicable
(actual and formal argument lists differ in length)
org/apache/maven/cli/logging/impl/LogbackConfiguration.java:38: error: package ch.qos.logback.classic does not exist
ch.qos.logback.classic.Level value;
^
org/apache/maven/cli/logging/impl/LogbackConfiguration.java:42: error: package ch.qos.logback.classic does not exist
value = ch.qos.logback.classic.Level.DEBUG;
^
org/apache/maven/cli/logging/impl/LogbackConfiguration.java:46: error: package ch.qos.logback.classic does not exist
value = ch.qos.logback.classic.Level.INFO;
^
org/apache/maven/cli/logging/impl/LogbackConfiguration.java:50: error: package ch.qos.logback.classic does not exist
value = ch.qos.logback.classic.Level.ERROR;
^
org/apache/maven/cli/logging/impl/LogbackConfiguration.java:53: error: package ch.qos.logback.classic does not exist
( (ch.qos.logback.classic.Logger) LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME ) ).setLevel( value );
^
org/apache/maven/cli/logging/Slf4jLoggerManager.java:35: error: Slf4jLoggerManager is not abstract and does not override abstract method getThreshold(String,String) in LoggerManager
public class Slf4jLoggerManager
^
org/apache/maven/cli/transfer/AbstractMavenTransferListener.java:228: error: cannot find symbol
message.append( action ).append( ' ' ).append( direction ).append( ' ' ).append( resource.getRepositoryId() );
^
symbol: method getRepositoryId()
location: variable resource of type TransferResource
org/apache/maven/cli/transfer/AbstractMavenTransferListener.java:241: error: cannot find symbol
out.println( "[WARNING] " + event.getException().getMessage() + " from " + resource.getRepositoryId() + " for "
^
symbol: method getRepositoryId()
location: variable resource of type TransferResource
org/apache/maven/cli/transfer/AbstractMavenTransferListener.java:256: error: cannot find symbol
message.append( action ).append( ' ' ).append( direction ).append( ' ' ).append( resource.getRepositoryId() );
^
symbol: method getRepositoryId()
location: variable resource of type TransferResource
org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java:60: error: cannot find symbol
message.append( action ).append( ' ' ).append( direction ).append( ' ' ).append( resource.getRepositoryId() );
^
symbol: method getRepositoryId()
location: variable resource of type TransferResource
org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java:72: error: cannot find symbol
out.warn( event.getException().getMessage() + " from " + resource.getRepositoryId() + " for "
^
symbol: method getRepositoryId()
location: variable resource of type TransferResource
org/apache/maven/cli/transfer/Slf4jMavenTransferListener.java:87: error: cannot find symbol
message.append( action ).append( ' ' ).append( direction ).append( ' ' ).append( resource.getRepositoryId() );
^
symbol: method getRepositoryId()
location: variable resource of type TransferResource
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: org/apache/maven/cli/internal/extension/model/io/xpp3/CoreExtensionsXpp3Reader.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
17 errors
Turns out that was due to using eclipse aether instead of the one in maven-resolver. Which contains eclipse aether. Inversely I was using plexus-containers-default for maven-embedder and it wanted sisu-plexus. Maven is a mess!!!
Slowly making progress
$ mvn --version
null <version unknown>
null home: /usr/share/maven
Java version: 11-ea, vendor: Oracle Corporation, runtime: /opt/oracle-jdk-bin-11_pre26
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.17.8-gentoo", arch: "amd64", family: "unix
$ mvn
[ERROR] Error executing Maven.
java.lang.NullPointerException
at java.base/java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
at java.base/java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
at java.base/java.util.Properties.put(Properties.java:1316)
at java.base/java.util.Properties.setProperty(Properties.java:225)
at org.apache.maven.cli.MavenCli.populateProperties(MavenCli.java:1672)
at org.apache.maven.cli.MavenCli.properties(MavenCli.java:596)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:278)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
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.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Getting closer but still no cigar yet. Think I have an extra file in slf4j-api. The failing error is odd. May take some time to get this fully worked out.
$ mvn --version
Apache Maven 3.5.4 (0; 1970-01-18T13:22:55-05:00)
Maven home: /usr/share/maven
Java version: 11-ea, vendor: Oracle Corporation, runtime: /opt/oracle-jdk-bin-11_pre26
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.17.8-gentoo", arch: "amd64", family: "unix"
$ mvn
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/share/maven/lib/slf4j-simple.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/maven/lib/maven-slf4j-provider.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.SimpleLoggerFactory]
[WARNING] The SLF4J binding actually used is not supported by Maven: org.slf4j.impl.SimpleLoggerFactory
[WARNING] Maven supported bindings are:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by net.sf.cglib.core.ReflectUtils$1 (file:/usr/share/maven/lib/cglib.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of net.sf.cglib.core.ReflectUtils$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] Error executing Maven.
[ERROR] java.util.NoSuchElementException
role: org.apache.maven.eventspy.internal.EventSpyDispatcher
roleHint:
[ERROR] Caused by: null
Having fun chasing my tail on slf4j loggers. The obvious fix to the above is removing the 2nd logger. The maven one is obviously needed. When I drop the slf4j-simple one....
Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.SimpleLoggerFactory
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
But that does not correct the real problem at the moment. Not sure what is causing the following.
[ERROR] Error executing Maven.
[ERROR] java.util.NoSuchElementException
role: org.apache.maven.eventspy.internal.EventSpyDispatcher
roleHint:
[ERROR] Caused by: null
The illegal access was fixed by adding to the java command in the launcher, hard coded argument. --add-opens java.base/java.lang=ALL-UNNAMED
Committed and pushed an initial dev-java/maven meta ebuild that provides mvn cli. It is non-functional at this time. The same errors as seen above. I have to look into that when I get more time.
I did some initial digging, and thus far this is where I see NoSuchElementException being thrown in the following packages; maven, maven-resoler, sisu.plexus. I hope fhe error comes from one of those. Maybe in some other location.
I feel like it is related to Plexus in some way due to the output mentioning role and roleHint. Those are Plexus component descriptor concepts. Maybe a missing xml file or something in a jar. I had missing stuff from maven-core in e4e67da
Can confirm the error message:
$ mvn clean
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/usr/share/maven/lib/maven-slf4j-provider.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/usr/share/maven/lib/slf4j-simple.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.MavenSimpleLoggerFactory]
[WARNING] The SLF4J binding actually used is not supported by Maven: org.slf4j.impl.MavenSimpleLoggerFactory
[WARNING] Maven supported bindings are:
[ERROR] Error executing Maven.
[ERROR] java.util.NoSuchElementException
role: org.apache.maven.eventspy.internal.EventSpyDispatcher
roleHint:
[ERROR] Caused by: null
equery list "*"|grep maven
dev-java/maven-3.5.4
dev-java/maven-artifact-3.5.4
dev-java/maven-builder-support-3.5.4
dev-java/maven-compat-3.5.4
dev-java/maven-core-3.5.4
dev-java/maven-embedder-3.5.4
dev-java/maven-model-3.5.4
dev-java/maven-model-builder-3.5.4
dev-java/maven-plugin-api-3.5.4
dev-java/maven-repository-metadata-3.5.4
dev-java/maven-resolver-api-1.1.1
dev-java/maven-resolver-connector-basic-1.1.1
dev-java/maven-resolver-impl-1.1.1
dev-java/maven-resolver-provider-3.5.4
dev-java/maven-resolver-spi-1.1.1
dev-java/maven-resolver-transport-wagon-1.1.1
dev-java/maven-resolver-util-1.1.1
dev-java/maven-settings-3.5.4
dev-java/maven-settings-builder-3.5.4
dev-java/maven-shared-utils-3.3.0
dev-java/maven-slf4j-provider-3.5.4
Thanks, I am aware of the issues and have taken them upstream on the maven development mailing list. While the topic is Modello from issue #48. The present issue there, java.util.NoSuchElementException, is the same as with Maven. Less the slf4j part of the output. Which is more a warning than a hard error. Still something that needs to be fixed. Once I resolve that exception for either maven or modello, it should be resolved for the other. Modello is needed to process .mdo files into .java. Presently using Maven sources for some of the packages in the mean time, till I can use ModelloCli.
I replaced all usage of aether with maven-resolver and, unfortunately, no change. I am still experiencing the same issue reported to upstream. Seems plexus/modello usage is a mystery to most including most maven developers. Need to find the few people or the one person that has a clue as to the issue. I believe it to be a plexus issue causing this issue and modello issue.