#1395  Maven build fails
Closed
wojtek opened 11 months ago

Executing simple mvn clean install fails with:

20:47:31,407 [ERROR] Failed to execute goal io.onedev:plugin-maven:2.6.2:generate-resources (generate-resources) on project server-core: Execution generate-resources of goal io.onedev:plugin-maven:2.6.2:generate-resources failed: java.util.zip.ZipException: zip file is empty -> [Help 1]

(btw. IDEA can't build the project either…)

Robin Shen changed fields 11 months ago
Name Previous Value Current Value
Type
Bug
Support Request
Robin Shen commented 11 months ago

Tested on a newly launched AWS ubuntu instance with below steps and it works fine:

sudo apt update
sudo apt install openjdk-11-jdk
sudo apt install maven
git clone https://code.onedev.io/onedev/server onedev
cd onedev
mvn clean install
wojtek commented 11 months ago

I'm using macOS but it shouldn't matter. I realised I'm using Java17 by default but even with v11 it's the same:

$ mvn -version
Apache Maven 3.9.2 (c9616018c7a021c1c39be70fb2843d6f5f9b8a1c)
Maven home: /opt/homebrew/Cellar/maven/3.9.2/libexec
Java version: 11.0.19, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home
Default locale: es_PL, platform encoding: UTF-8
OS name: "mac os x", version: "13.3.1", arch: "aarch64", family: "mac"
$ mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] server                                                             [pom]
[INFO] server-core                                                        [jar]
[INFO] server-plugin                                                      [pom]
[INFO] server-plugin-archetype                                            [jar]
[INFO] server-plugin-executor-kubernetes                                  [jar]
[INFO] server-plugin-executor-serverdocker                                [jar]
[INFO] server-plugin-buildspec-maven                                      [jar]
[INFO] server-plugin-buildspec-gradle                                     [jar]
[INFO] server-plugin-buildspec-node                                       [jar]
[INFO] server-plugin-authenticator-ldap                                   [jar]
[INFO] server-plugin-sso-openid                                           [jar]
[INFO] server-plugin-report-markdown                                      [jar]
[INFO] server-plugin-report-unittest                                      [jar]
[INFO] server-plugin-report-jest                                          [jar]
[INFO] server-plugin-report-coverage                                      [jar]
[INFO] server-plugin-report-clover                                        [jar]
[INFO] server-plugin-report-problem                                       [jar]
[INFO] server-plugin-report-checkstyle                                    [jar]
[INFO] server-plugin-import-github                                        [jar]
[INFO] server-plugin-import-gitlab                                        [jar]
[INFO] server-plugin-import-gitea                                         [jar]
[INFO] server-plugin-import-bitbucketcloud                                [jar]
[INFO] server-plugin-import-jiracloud                                     [jar]
[INFO] server-plugin-import-youtrack                                      [jar]
[INFO] server-plugin-import-url                                           [jar]
[INFO] server-plugin-executor-remotedocker                                [jar]
[INFO] server-plugin-executor-servershell                                 [jar]
[INFO] server-plugin-executor-remoteshell                                 [jar]
[INFO] server-plugin-report-junit                                         [jar]
[INFO] server-plugin-report-jacoco                                        [jar]
[INFO] server-plugin-report-spotbugs                                      [jar]
[INFO] server-plugin-report-pmd                                           [jar]
[INFO] server-plugin-report-cpd                                           [jar]
[INFO] server-plugin-sso-discord                                          [jar]
[INFO] server-plugin-notification-slack                                   [jar]
[INFO] server-plugin-notification-discord                                 [jar]
[INFO] server-product                                                     [jar]
[INFO]
[INFO] --------------------------< io.onedev:server >--------------------------
[INFO] Building server 8.2.7                                             [1/37]
[INFO]   from pom.xml
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ server ---
[INFO]
[INFO] --- enforcer:3.1.0:enforce (enforce-maven) @ server ---
[INFO]
[INFO] --- io.onedev:plugin-maven:2.6.2:generate-resources (generate-resources) @ server ---
[INFO]
[INFO] --- source:3.2.1:jar-no-fork (attach-sources) @ server ---
[INFO]
[INFO] --- io.onedev:plugin-maven:2.6.2:package-artifacts (package-artifacts) @ server ---
[INFO]
[INFO] --- install:3.0.1:install (default-install) @ server ---
[INFO] Installing /Users/wojtek/dev/onedev-server/pom.xml to /Users/wojtek/.m2/repository/io/onedev/server/8.2.7/server-8.2.7.pom
[INFO]
[INFO] -----------------------< io.onedev:server-core >------------------------
[INFO] Building server-core 8.2.7                                        [2/37]
[INFO]   from server-core/pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.eclipse.core:org.eclipse.core.contenttype:jar:3.4.200.v20140207 is missing, no dependency information available
[WARNING] The POM for org.eclipse.core:org.eclipse.core.jobs:jar:3.5.300.v20130429 is missing, no dependency information available
[WARNING] The POM for org.eclipse.core:org.eclipse.core.resources:jar:3.9.1.v20140825 is missing, no dependency information available
[WARNING] The POM for org.eclipse.core:org.eclipse.core.runtime:jar:3.13.0.v20170207 is missing, no dependency information available
[WARNING] The POM for org.eclipse.core:org.eclipse.core.filesystem:jar:1.7.0.v20170406 is missing, no dependency information available
[WARNING] The POM for org.eclipse:org.eclipse.osgi:jar:3.12.0.v20170512 is missing, no dependency information available
[WARNING] The POM for org.eclipse.equinox:org.eclipse.equinox.registry:jar:3.5.400.v20140428 is missing, no dependency information available
[WARNING] The POM for org.eclipse.equinox:org.eclipse.equinox.common:jar:3.6.200.v20130402 is missing, no dependency information available
[WARNING] The POM for org.eclipse.cdt:org.eclipse.cdt.core:jar:5.11.0 is missing, no dependency information available
Downloading from onedev: https://artifact.onedev.io/artifactory/onedev/net/minidev/json-smart/maven-metadata.xml
[INFO]
[INFO] --- clean:3.2.0:clean (default-clean) @ server-core ---
[INFO] Deleting /Users/wojtek/dev/onedev-server/server-core/target
[INFO]
[INFO] --- enforcer:3.1.0:enforce (enforce-maven) @ server-core ---
[INFO]
[INFO] --- io.onedev:plugin-maven:2.6.2:generate-resources (generate-resources) @ server-core ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for server 8.2.7:
[INFO]
[INFO] server ............................................. SUCCESS [  0.422 s]
[INFO] server-core ........................................ FAILURE [  1.591 s]
[INFO] server-plugin ...................................... SKIPPED
[INFO] server-plugin-archetype ............................ SKIPPED
[INFO] server-plugin-executor-kubernetes .................. SKIPPED
[INFO] server-plugin-executor-serverdocker ................ SKIPPED
[INFO] server-plugin-buildspec-maven ...................... SKIPPED
[INFO] server-plugin-buildspec-gradle ..................... SKIPPED
[INFO] server-plugin-buildspec-node ....................... SKIPPED
[INFO] server-plugin-authenticator-ldap ................... SKIPPED
[INFO] server-plugin-sso-openid ........................... SKIPPED
[INFO] server-plugin-report-markdown ...................... SKIPPED
[INFO] server-plugin-report-unittest ...................... SKIPPED
[INFO] server-plugin-report-jest .......................... SKIPPED
[INFO] server-plugin-report-coverage ...................... SKIPPED
[INFO] server-plugin-report-clover ........................ SKIPPED
[INFO] server-plugin-report-problem ....................... SKIPPED
[INFO] server-plugin-report-checkstyle .................... SKIPPED
[INFO] server-plugin-import-github ........................ SKIPPED
[INFO] server-plugin-import-gitlab ........................ SKIPPED
[INFO] server-plugin-import-gitea ......................... SKIPPED
[INFO] server-plugin-import-bitbucketcloud ................ SKIPPED
[INFO] server-plugin-import-jiracloud ..................... SKIPPED
[INFO] server-plugin-import-youtrack ...................... SKIPPED
[INFO] server-plugin-import-url ........................... SKIPPED
[INFO] server-plugin-executor-remotedocker ................ SKIPPED
[INFO] server-plugin-executor-servershell ................. SKIPPED
[INFO] server-plugin-executor-remoteshell ................. SKIPPED
[INFO] server-plugin-report-junit ......................... SKIPPED
[INFO] server-plugin-report-jacoco ........................ SKIPPED
[INFO] server-plugin-report-spotbugs ...................... SKIPPED
[INFO] server-plugin-report-pmd ........................... SKIPPED
[INFO] server-plugin-report-cpd ........................... SKIPPED
[INFO] server-plugin-sso-discord .......................... SKIPPED
[INFO] server-plugin-notification-slack ................... SKIPPED
[INFO] server-plugin-notification-discord ................. SKIPPED
[INFO] server-product ..................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.144 s
[INFO] Finished at: 2023-05-26T21:30:40-04:00
[INFO] ------------------------------------------------------------------------
[WARNING]
[WARNING] Plugin validation issues were detected in 2 plugin(s)
[WARNING]
[WARNING]  * org.apache.maven.plugins:maven-source-plugin:3.2.1
[WARNING]  * org.apache.maven.plugins:maven-enforcer-plugin:3.1.0
[WARNING]
[WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE]
[WARNING]
[ERROR] Failed to execute goal io.onedev:plugin-maven:2.6.2:generate-resources (generate-resources) on project server-core: Execution generate-resources of goal io.onedev:plugin-maven:2.6.2:generate-resources failed: java.util.zip.ZipException: zip file is empty -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :server-core

It seems that the issue is with: https://artifact.onedev.io/artifactory/onedev/net/minidev/json-smart/maven-metadata.xml:

$ wget https://artifact.onedev.io/artifactory/onedev/net/minidev/json-smart/maven-metadata.xml
--2023-05-26 21:31:25--  https://artifact.onedev.io/artifactory/onedev/net/minidev/json-smart/maven-metadata.xml
Resolving artifact.onedev.io (artifact.onedev.io)... 34.209.148.245
Connecting to artifact.onedev.io (artifact.onedev.io)|34.209.148.245|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2023-05-26 21:31:26 ERROR 404: Not Found.
Robin Shen commented 11 months ago

It seems that the issue is with: https://artifact.onedev.io/artifactory/onedev/net/minidev/json-smart/maven-metadata.xml:

OneDev artifactory instance is a proxy, and maven will resort to maven central if not found. I daily develop OneDev on Mac x86, and it also builds successfully. I do not have Mac arm for testing. If you can help investigating the issue it will be great.

wojtek commented 11 months ago

(does 1dev refresh the page? and/or has comment cache? I typed a comment here and left it for a bit while investigating the issue and it was gone)

Either way - I removed "generate-resources" execution and it finally pointed that the "zip is empty" error was actually due to lucene artifact jar being empty, I removed it from local repo:

/Users/wojtek/.m2/repository/org/apache/lucene/lucene-core/8.7.0/

And it worked. Odd.

Anyhow, in terms of maven build there is another issue and I had to build the server without running the tests:

[ERROR] Errors:
[ERROR]   GitUtilsTest.testRebaseWithEmptyCommit:98 » JGitInternal Failed to parse secret key file /Users/wojtek/.gnupg/private-keys-v1.d/1CB84D27…DDD4747785B5.key. Is the entered passphrase correct?
[ERROR]   LastCommitsOfChildrenTest.testMergeTouchingSameFile:38 » JGitInternal Failed to parse secret key file /Users/wojtek/.gnupg/private-keys-v1.d/1CB84D27…DDD4747785B5.key. Is the entered passphrase correct?
[ERROR]   LastCommitsOfChildrenTest.testMergeWithoutTouchingSameFile:23 » JGitInternal Failed to parse secret key file /Users/wojtek/.gnupg/private-keys-v1.d/1CB84D27…DDD4747785B5.key. Is the entered passphrase correct?
[ERROR]   LastCommitsOfChildrenTest.testWithCache:67 » JGitInternal Failed to parse secret key file /Users/wojtek/.gnupg/private-keys-v1.d/1CB84D27…DDD4747785B5.key. Is the entered passphrase cor

Why does it try to access my private keys? From the code it seems it just Eclipse git client trying to commit and it uses local git installation for that?

git.commit().setAllowEmpty(true).setMessage("empty").call();
Robin Shen commented 11 months ago

OneDev uses jgit to run some git test cases. And it tries to read gpg key for signing test commit if available. Please pull latest code which disabled commit signing for test commits.

As to comment not being displayed, OneDev uses websocket to update UI, sometimes it misses update either due to network, or due to incorrect config of browser proxy, or when session times out.

wojtek commented 11 months ago

OneDev uses jgit to run some git test cases. And it tries to read gpg key for signing test commit if available. Please pull latest code which disabled commit signing for test commits.

Works now, thanks.

As to comment not being displayed, OneDev uses websocket to update UI, sometimes it misses update either due to network, or due to incorrect config of browser proxy, or when session times out.

Hmm... but would that result in the comment typed in the comment box (but not yet submitted) to vanish? I would expect it to be rather the opposite - it would be retained even if I close the tab (a lot of sites do that, github or various forum softwares), virtually having a persistent draft.

Robin Shen changed state to 'Closed' 11 months ago
Previous Value Current Value
Open
Closed
Robin Shen commented 11 months ago

Closing this now. As to save comment while editing to prevent loss, please watch/vote issue #838

qintao commented 9 months ago

I encountered the same problem,and then I identified abnormal dependencies by logging in the maven-plugin module (before PluginUtils throw exception print abnormal filename) . I deleted the dependencies in the local maven repository and re downloaded them to solve the problem. but there have another problem, the dependency 'org.jvnet.winp:winp:jar:1.30' can not found in maven central and 'https://artifact.onedev.io/artifactory/onedev'. In maven central, the highest version is 1.28, then I saw that the 'commons' module was configured repository with 'jenkins' and 'jetbrains', perhaps the version 1.30 in there.

Robin Shen commented 9 months ago

@qintao please pull latest version to see if it works.

issue 1 of 1
Type
Question
Priority
Normal
Assignee
Issue Votes (0)
Watchers (5)
Reference
onedev/server#1395
Please wait...
Page is in error, reload to recover