[ 
https://jira.codehaus.org/browse/MDEP-442?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Laura Llewellyn updated MDEP-442:
---------------------------------

    Attachment: maven-thread-test.zip

Here is a maven-invoker-test case that demonstrates this problem in my 
environment.  Output of {{mvn --version}}:
{code}Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 
2014-06-17T09:51:42-04:00)
Maven home: c:\dev\maven\apache-maven-3.2.2
Java version: 1.7.0_55, vendor: Oracle Corporation
Java home: c:\Program Files\Java\jdk1.7.0_55\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
{code}

I run {{mvn clean verify}} in this project and the {{build.log}} files for the 
its have exceptions like this:

{code}
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its 
dependencies could not be resolved: Failed to read artifact descriptor for 
org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer 
artifact org.apache.maven.plugins:maven-plugins:pom:22 from/to local.central 
(file:///c:/dev/artifact-repository): 
C:\dev\sandbox\maven-thread-test\target\local-repo\org\apache\maven\plugins\maven-plugins\22\maven-plugins-22.pom
 (The process cannot access the file because it is being used by another 
process) -> [Help 1]
org.apache.maven.plugin.PluginResolutionException: Plugin 
org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies 
could not be resolved: Failed to read artifact descriptor for 
org.apache.maven.plugins:maven-clean-plugin:jar:2.5
        at 
org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:122)
        at 
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:148)
        at 
org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:267)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:239)
        at 
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:158)
        at 
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:145)
        at 
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:122)
        at 
org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:135)
        at 
org.apache.maven.lifecycle.internal.builder.BuilderCommon.resolveBuildPlan(BuilderCommon.java:97)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:109)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at 
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        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.eclipse.aether.resolution.ArtifactDescriptorException: Failed to 
read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
        at 
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:384)
        at 
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:231)
        at 
org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:288)
        at 
org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:108)
        ... 25 more
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could 
not transfer artifact org.apache.maven.plugins:maven-plugins:pom:22 from/to 
local.central (file:///c:/dev/artifact-repository): 
C:\dev\sandbox\maven-thread-test\target\local-repo\org\apache\maven\plugins\maven-plugins\22\maven-plugins-22.pom
 (The process cannot access the file because it is being used by another 
process)
        at 
org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:154)
        at 
org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:203)
        at 
org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:903)
        at 
org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:755)
        at 
org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:309)
        at 
org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:375)
        ... 28 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not 
transfer artifact org.apache.maven.plugins:maven-plugins:pom:22 from/to 
local.central (file:///c:/dev/artifact-repository): 
C:\dev\sandbox\maven-thread-test\target\local-repo\org\apache\maven\plugins\maven-plugins\22\maven-plugins-22.pom
 (The process cannot access the file because it is being used by another 
process)
        at 
org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
        at 
org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
        at 
org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239)
        at 
org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:150)
        ... 33 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not 
transfer artifact org.apache.maven.plugins:maven-plugins:pom:22 from/to 
local.central (file:///c:/dev/artifact-repository): 
C:\dev\sandbox\maven-thread-test\target\local-repo\org\apache\maven\plugins\maven-plugins\22\maven-plugins-22.pom
 (The process cannot access the file because it is being used by another 
process)
        at 
org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(WagonRepositoryConnector.java:1016)
        at 
org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(WagonRepositoryConnector.java:1004)
        at 
org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:725)
        at 
org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.FileNotFoundException: 
C:\dev\sandbox\maven-thread-test\target\local-repo\org\apache\maven\plugins\maven-plugins\22\maven-plugins-22.pom
 (The process cannot access the file because it is being used by another 
process)
        at java.io.FileOutputStream.open(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
        at 
org.eclipse.aether.internal.impl.DefaultFileProcessor.copy(DefaultFileProcessor.java:155)
        at 
org.eclipse.aether.internal.impl.DefaultFileProcessor.copy(DefaultFileProcessor.java:139)
        at 
org.eclipse.aether.internal.impl.DefaultFileProcessor.move(DefaultFileProcessor.java:214)
        at 
org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.rename(WagonRepositoryConnector.java:817)
        at 
org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:703)
        ... 4 more
{code}

Given this, I'm not sure if this is a problem with the dependency plugin 
itself, or with the shared components Maven uses to resolve dependencies. I 
will let someone with more Maven experience make that call.

> Failed to access file due to locked access when using more than one Maven 
> worker thread
> ---------------------------------------------------------------------------------------
>
>                 Key: MDEP-442
>                 URL: https://jira.codehaus.org/browse/MDEP-442
>             Project: Maven Dependency Plugin
>          Issue Type: Bug
>          Components: copy
>    Affects Versions: 2.8
>         Environment: MVN 3.0.4, JDK 1.7, Win 7 Pro SP1 64 Bit
>            Reporter: Markus KARG
>            Priority: Critical
>         Attachments: maven-thread-test.zip
>
>
> My multi-module POM contains of ten modules. Each of that modules does the 
> same: Invoke the 'copy' goal of the dependency plugin. The idea is to have 
> ten copies of the identical source, which then will end up in ten different 
> targets by getting furthere processed.
> As long as I do not use more than one Maven worker thread, everything works 
> well always. But when using -T 5 to have five worker threads, rather often 
> the reactor fails because the source file (!) is locked:
> {noformat}
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-dependency-plugin:2.8:copy (copy) on project 
> MYARTIFACT: Unable to resolve artifact. Could not transfer artifact 
> mygroup:myartifact:dll:4.36.1-20140415.143537-37 from/to nexus 
> (http://nexus/nexus/content/groups/public): 
> C:\Users\jenkins.QUIPSY\.m2\repository\mygroup\myartifact\4.36.1-SNAPSHOT\myartifact-4.36.1-20140415.143537-37.dll
>  (The process cannot access the file, because it is in use by another process)
> {noformat}
> So it seems that the 'copy' task actually is locking the source file, which 
> is not multi-threading-compatible. Hence, either that is a bug and should get 
> fixed, or it is on purpose, then this goal has to be marked as 
> non-multithreading-able.



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to