How does org.apache.maven.indexer:indexer-cli:7.1.1 work?
Question
I'm tying to create an Maven index for my private project and I'm tying to use org.apache.maven.indexer:indexer-cli:7.1.1 to do so. However, when calling the jar all I get is an error message:
> java -jar /…/org/apache/maven/indexer/indexer-cli/7.1.1/indexer-cli-7.1.1.jar \
--repository "${HOMEPAGE_DEPLOY}" \
--index "${HOMEPAGE_DEPLOY}/.index" \
--destination "${HOMEPAGE_DEPLOY}/.index" \
--name "${PROJECT_NAME}"
kein Hauptmanifestattribut, in /…/org/apache/maven/indexer/indexer-cli/7.1.1/indexer-cli-7.1.1.jar
Yes, all pathnames have been checked and a simplified call doesn't work as well:
>pushd /…/org/apache/maven/indexer/indexer-cli/7.1.1/
>java -jar indexer-cli-7.1.1.jar
kein Hauptmanifestattribut, in indexer-cli-7.1.1.jar
The only documentation I found uses java -jar
as well but that was for version 5.1.1 so I wonder if something changed.
I know about the nexus indexer but that one has stopped working after I moved to Java 11 and I don't want to be stuck with Java 8 forever. (They should have called Java 9 Java 2.0 as it's a mayor and incompatible upgrade)
Update 1:
For completeness sake I did try org.apache.maven.indexer:indexer-cli:5.1.1 and that actually works as expected. As does org.apache.maven.indexer:indexer-cli:6.2.2 but not org.apache.maven.indexer:indexer-cli:7.0.4.
So it's change for Version 7.
Update 2:
After @khmarbaise question I decided to check the content of the the Jar-file. The file content looks ok and a MANIFEST.MF is present.
>7z l /…/org/apache/maven/indexer/indexer-cli/7.1.1/indexer-cli-7.1.1.jar
7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=utf8,Utf16=on,HugeFiles=on,64 bits,16 CPUs x64)
Scanning the drive for archives:
1 file, 22886 bytes (23 KiB)
Listing archive: /…/org/apache/maven/indexer/indexer-cli/7.1.1/indexer-cli-7.1.1.jar
--
Path = /…/org/apache/maven/indexer/indexer-cli/7.1.1/indexer-cli-7.1.1.jar
Type = zip
Physical Size = 22886
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2023-12-13 22:35:30 D.... 0 0 META-INF
2023-12-13 22:35:30 ..... 336 171 META-INF/MANIFEST.MF
2023-12-13 22:35:30 D.... 0 0 META-INF/sisu
2023-12-13 22:35:30 D.... 0 0 org
2023-12-13 22:35:30 D.... 0 0 org/apache
2023-12-13 22:35:30 D.... 0 0 org/apache/maven
2023-12-13 22:35:30 D.... 0 0 org/apache/maven/index
2023-12-13 22:35:30 D.... 0 0 org/apache/maven/index/cli
2023-12-13 22:35:30 D.... 0 0 META-INF/maven
2023-12-13 22:35:30 D.... 0 0 META-INF/maven/org.apache.maven.indexer
2023-12-13 22:35:30 D.... 0 0 META-INF/maven/org.apache.maven.indexer/indexer-cli
2023-12-13 22:35:30 ..... 6190 1331 META-INF/DEPENDENCIES
2023-12-13 22:35:30 ..... 11358 3949 META-INF/LICENSE
2023-12-13 22:35:30 ..... 175 130 META-INF/NOTICE
2023-12-13 22:35:30 ..... 38 40 META-INF/sisu/javax.inject.Named
2023-12-13 22:35:30 ..... 732 403 org/apache/maven/index/cli/Components.class
2023-12-13 22:35:30 ..... 1016 516 org/apache/maven/index/cli/NexusIndexerCli$1.class
2023-12-13 22:35:30 ..... 4316 2051 org/apache/maven/index/cli/NexusIndexerCli$IndexerListener.class
2023-12-13 22:35:30 ..... 17445 8267 org/apache/maven/index/cli/NexusIndexerCli.class
2023-12-13 22:35:30 ..... 2093 951 org/apache/maven/index/cli/PartialImplementation.class
2023-12-13 22:35:30 ..... 6685 1917 META-INF/maven/org.apache.maven.indexer/indexer-cli/pom.xml
2023-12-13 22:35:30 ..... 70 66 META-INF/maven/org.apache.maven.indexer/indexer-cli/pom.properties
------------------- ----- ------------ ------------ ------------------------
2023-12-13 22:35:30 50454 19792 12 files, 10 folders
I checked the sha1 checksum as well and is matches as well. Lastly I checked the MANIFEST.MF
which is indeed missing the the Main-Class:
entry:
>cat META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: Maven JAR Plugin 3.3.0
Build-Jdk-Spec: 21
Specification-Title: Maven :: Indexer CLI
Specification-Version: 7.1
Specification-Vendor: The Apache Software Foundation
Implementation-Title: Maven :: Indexer CLI
Implementation-Version: 7.1.1
Implementation-Vendor: The Apache Software Foundation
Why did it work for @khmarbaise with a missing Main-Class:
in the MANIFEST.MF
?
Update 3:
Installed java 21 and tried again. Same result for Oracle Java and openjdk:
>JDK_HOME=/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home \
>JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home \
>/Library/Java/JavaVirtualMachines/jdk-21.jdk/Contents/Home/bin/java -jar indexer-cli-7.1.1.jar
kein Hauptmanifestattribut, in indexer-cli-7.1.1.jar
>JDK_HOME=/usr/local/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home \
>JAVA_HOME=/usr/local/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home \
>/usr/local/Cellar/openjdk/21.0.1/libexec/openjdk.jdk/Contents/Home/bin/java -jar indexer-cli-7.1.1.jar
kein Hauptmanifestattribut, in indexer-cli-7.1.1.jar
Answer
Answering my own question (again). With Version 7 and onwards the file structure of indexer-cli package has changed. For comparison:
Version 6.2.2:
org/apache/maven/indexer/indexer-cli/6.2.2
../
indexer-cli-6.2.2-javadoc.jar 2022-07-16 15:47 136897
indexer-cli-6.2.2-javadoc.jar.asc 2022-07-16 15:47 833
indexer-cli-6.2.2-javadoc.jar.md5 2022-07-16 15:47 32
indexer-cli-6.2.2-javadoc.jar.sha1 2022-07-16 15:47 40
indexer-cli-6.2.2-sources.jar 2022-07-16 15:47 15752
indexer-cli-6.2.2-sources.jar.asc 2022-07-16 15:47 833
indexer-cli-6.2.2-sources.jar.md5 2022-07-16 15:47 32
indexer-cli-6.2.2-sources.jar.sha1 2022-07-16 15:47 40
indexer-cli-6.2.2.jar 2022-07-16 15:47 12672807
indexer-cli-6.2.2.jar.asc 2022-07-16 15:47 833
indexer-cli-6.2.2.jar.md5 2022-07-16 15:47 32
indexer-cli-6.2.2.jar.sha1 2022-07-16 15:47 40
indexer-cli-6.2.2.pom 2022-07-16 15:47 6599
indexer-cli-6.2.2.pom.asc 2022-07-16 15:47 833
indexer-cli-6.2.2.pom.md5 2022-07-16 15:47 32
indexer-cli-6.2.2.pom.sha1 2022-07-16 15:47 40
Version 7.1.1:
org/apache/maven/indexer/indexer-cli/7.1.1
../
indexer-cli-7.1.1-cli.jar 2023-12-13 22:39 13617488
indexer-cli-7.1.1-cli.jar.asc 2023-12-13 22:39 833
indexer-cli-7.1.1-cli.jar.md5 2023-12-13 22:39 32
indexer-cli-7.1.1-cli.jar.sha1 2023-12-13 22:39 40
indexer-cli-7.1.1-cyclonedx.json 2023-12-13 22:39 78614
indexer-cli-7.1.1-cyclonedx.json.asc 2023-12-13 22:39 833
indexer-cli-7.1.1-cyclonedx.json.md5 2023-12-13 22:39 32
indexer-cli-7.1.1-cyclonedx.json.sha1 2023-12-13 22:39 40
indexer-cli-7.1.1-cyclonedx.xml 2023-12-13 22:39 66952
indexer-cli-7.1.1-cyclonedx.xml.asc 2023-12-13 22:39 833
indexer-cli-7.1.1-cyclonedx.xml.md5 2023-12-13 22:39 32
indexer-cli-7.1.1-cyclonedx.xml.sha1 2023-12-13 22:39 40
indexer-cli-7.1.1-javadoc.jar 2023-12-13 22:39 114999
indexer-cli-7.1.1-javadoc.jar.asc 2023-12-13 22:39 833
indexer-cli-7.1.1-javadoc.jar.md5 2023-12-13 22:39 32
indexer-cli-7.1.1-javadoc.jar.sha1 2023-12-13 22:39 40
indexer-cli-7.1.1-sources.jar 2023-12-13 22:39 17046
indexer-cli-7.1.1-sources.jar.asc 2023-12-13 22:39 833
indexer-cli-7.1.1-sources.jar.md5 2023-12-13 22:39 32
indexer-cli-7.1.1-sources.jar.sha1 2023-12-13 22:39 40
indexer-cli-7.1.1.jar 2023-12-13 22:39 22886
indexer-cli-7.1.1.jar.asc 2023-12-13 22:39 833
indexer-cli-7.1.1.jar.md5 2023-12-13 22:39 32
indexer-cli-7.1.1.jar.sha1 2023-12-13 22:39 40
indexer-cli-7.1.1.pom 2023-12-13 22:39 6685
indexer-cli-7.1.1.pom.asc 2023-12-13 22:39 833
indexer-cli-7.1.1.pom.md5 2023-12-13 22:39 32
indexer-cli-7.1.1.pom.sha1 2023-12-13 22:39 40
There are now far more files then before and the name of the actual executable has changed from indexer-cli-6.2.2.jar
to indexer-cli-7.1.1-cli.jar