Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundException while remap goal #4

Closed
Snoop1CattZ69 opened this issue Mar 2, 2022 · 5 comments
Closed

FileNotFoundException while remap goal #4

Snoop1CattZ69 opened this issue Mar 2, 2022 · 5 comments

Comments

@Snoop1CattZ69
Copy link

pom.xml
https://pastebin.com/3WkEmRpd

My Maven log with -e

$ mvn install -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< ru.aslteam:ejcore >--------------------------
[INFO] Building ejCore 1.2.16
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ejcore ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.0:compile (default-compile) @ ejcore ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ejcore ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory P:\nWorkspace\ejCore\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.0:testCompile (default-testCompile) @ ejcore ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ ejcore ---
[INFO] No tests to run.
[INFO]
[INFO] --- paper-nms-maven-plugin:1.0:remap (default) @ ejcore ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.576 s
[INFO] Finished at: 2022-03-02T02:25:28+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal ca.bkaw:paper-nms-maven-plugin:1.0:remap (default) on project ejcore: Failed to remap artifact: P:\nWorkspace\ejCore\target\classes (access denied) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal ca.bkaw:paper-nms-maven-plugin:1.0:remap (default) on project ejcore: Failed to remap artifact
    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:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    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)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to remap artifact
    at ca.bkaw.papernmsmavenplugin.RemapMojo.execute (RemapMojo.java:78)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    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 (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:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    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)
Caused by: java.io.FileNotFoundException: P:\nWorkspace\ejCore\target\classes (access denied)
    at java.io.RandomAccessFile.open0 (Native Method)
    at java.io.RandomAccessFile.open (RandomAccessFile.java:344)
    at java.io.RandomAccessFile.<init> (RandomAccessFile.java:259)
    at java.io.RandomAccessFile.<init> (RandomAccessFile.java:213)
    at java.util.zip.ZipFile$Source.<init> (ZipFile.java:1312)
    at java.util.zip.ZipFile$Source.get (ZipFile.java:1277)
    at java.util.zip.ZipFile$CleanableResource.<init> (ZipFile.java:709)
    at java.util.zip.ZipFile.<init> (ZipFile.java:243)
    at java.util.zip.ZipFile.<init> (ZipFile.java:172)
    at java.util.jar.JarFile.<init> (JarFile.java:347)
    at java.util.jar.JarFile.<init> (JarFile.java:318)
    at java.util.jar.JarFile.<init> (JarFile.java:284)
    at ca.bkaw.papernmsmavenplugin.MojoBase.mapJar (MojoBase.java:716)
    at ca.bkaw.papernmsmavenplugin.RemapMojo.execute (RemapMojo.java:76)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    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 (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:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    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)
[ERROR]
[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/MojoExecutionException

Eclipse & Maven & User has admin permissions to path P:\nWorkspace\ejCore\target\classes

@Alvinn8
Copy link
Owner

Alvinn8 commented Mar 2, 2022

It appears this is because you have configured remap to run at prepare-package instead of package, which means there is no jar yet and instead the classes folder is what maven returns. This plugin then tries to read that as a jar file, which doesn't work as it's a directory. When I changed prepare-package to package in your pom.xml the issue was resolved. Is there any reason you need to use this, or can you change to package? Although I might look into remapping the classes before there is a jar, for example during prepare-package or process-classes as that might feel more appropriate than remapping the entire final jar. Thanks for the well-made issue!

@Snoop1CattZ69
Copy link
Author

Snoop1CattZ69 commented Mar 2, 2022

It appears this is because you have configured remap to run at prepare-package instead of package, which means there is no jar yet and instead the classes folder is what maven returns. This plugin then tries to read that as a jar file, which doesn't work as it's a directory. When I changed prepare-package to package in your pom.xml the issue was resolved. Is there any reason you need to use this, or can you change to package? Although I might look into remapping the classes before there is a jar, for example during prepare-package or process-classes as that might feel more appropriate than remapping the entire final jar. Thanks for the well-made issue!

changed back to package and what I got:
https://pastebin.com/VDS6C1Ni

Tried to run mvn install firstly using Eclipse IDE, I got this error, then I closed Eclipse and tried mvn install using terminal, and again same error.

UPD: Executing with root permissions throws same error.

UPD2: More Info
OS: Windows 10 (build 1909)
IDE: Eclipse 2022-03 (4.23.0 M3) (Lombok included)
JDK: Eclipse Adoptium JDK-11 for Eclipse run and Eclipse Adoptium JDK-17 for project build.

@Alvinn8
Copy link
Owner

Alvinn8 commented Mar 2, 2022

I pushed an update to the plugin, try updating the plugin to version 1.1 and change the phase to process-classes (alternatively prepare-package).

@Snoop1CattZ69
Copy link
Author

I pushed an update to the plugin, try updating the plugin to version 1.1 and change the phase to process-classes (alternatively prepare-package).

Solved
Thanks <3

@Alvinn8
Copy link
Owner

Alvinn8 commented Mar 2, 2022

Great! Thanks again for the bug report 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants