[
https://issues.apache.org/jira/browse/MJAR-97?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17957180#comment-17957180
]
Matthias Bünger commented on MJAR-97:
-------------------------------------
This project has moved from Jira to GitHub Issues. This issue was migrated to
[apache/maven-jar-plugin#282|https://github.com/apache/maven-jar-plugin/issues/282].
> Using <addClasspath> when you have no dependencies fails with
> FileNotFoundException
> -----------------------------------------------------------------------------------
>
> Key: MJAR-97
> URL: https://issues.apache.org/jira/browse/MJAR-97
> Project: Maven JAR Plugin (Moved to GitHub Issues)
> Issue Type: Bug
> Affects Versions: 2.2
> Environment: Maven version: 2.0.8
> Java version: 1.6.0_01
> OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"
> Reporter: Wim Deblauwe
> Priority: Major
> Attachments: fix.patch
>
>
> When you have no dependencies in your project and configure
> <addClasspath>true</addClasspath> for the jar plugin, then maven exits with a
> strange error message:
> {noformat}
> Embedded error: Problem creating jar: C:\personal\mytool\target\classes
> (Access is denied)
> {noformat}
> If I run with -e, you can see that the classes directory is trying to be
> opened like it is a file:
> {noformat}
> [INFO] Trace
> org.apache.maven.lifecycle.LifecycleExecutionException: Error assembling JAR
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:459)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:333)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
> at
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
> at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
> Caused by: org.apache.maven.plugin.MojoExecutionException: Error assembling
> JAR
> at
> org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:225)
> at
> org.apache.maven.plugin.jar.AbstractJarMojo.execute(AbstractJarMojo.java:237)
> at
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:447)
> at
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
> ... 16 more
> Caused by: org.codehaus.plexus.archiver.ArchiverException: Problem creating
> jar:
> C:\personal\mytool\target\classes (Access is denied)
> at
> org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:690)
> at
> org.apache.maven.archiver.MavenArchiver.createArchive(MavenArchiver.java:421)
> at
> org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:218)
> ... 19 more
> Caused by: java.io.FileNotFoundException: C:\personal\mytool\target\classes
> (Access is denied)
> at java.io.RandomAccessFile.open(Native Method)
> at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
> at org.codehaus.plexus.archiver.zip.ZipFile.<init>(ZipFile.java:147)
> at org.codehaus.plexus.archiver.zip.ZipFile.<init>(ZipFile.java:132)
> at
> org.codehaus.plexus.archiver.jar.JarArchiver.grabFilesAndDirs(JarArchiver.java:922)
> at
> org.codehaus.plexus.archiver.jar.JarArchiver.createIndexList(JarArchiver.java:499)
> at
> org.codehaus.plexus.archiver.jar.JarArchiver.finalizeZipOutputStream(JarArchiver.java:422)
> at
> org.codehaus.plexus.archiver.zip.AbstractZipArchiver.execute(AbstractZipArchiver.java:245)
> at
> org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:673)
> ... 21 more
> {noformat}
> The workaround it to remove the <addClasspath/> thing ofcourse, but maven
> should give a better error message to avoid that people spend an hour
> searching for processes that keep the directory busy, when there is really a
> configuration problem.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)