Failed to Copy Aritfact in Eclipse Ganymede with Workspace Resolution Enabled

http://jira.codehaus.org/browse/MAPPASM-82

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>appassembler-maven-plugin</artifactId>
    <version>1.1.1</version>
    <executions>
     <execution>
      <!-- new gateway start script -->
      <id>new-start-script</id>
      <phase>prepare-package</phase>
      <configuration>
       <assembleDirectory>${project.build.directory}</assembleDirectory>
       <extraJvmArguments>-Xms256m -Xmx512m -Dapp.name=${SERVER_NAME}_svr -Dlogfile=$LOGFILE
       </extraJvmArguments>
       <repositoryName>lib</repositoryName>
       <repositoryLayout>flat</repositoryLayout>
       <configurationDirectory>config</configurationDirectory>
       <copyConfigurationDirectory>false</copyConfigurationDirectory>
       <includeConfigurationDirectoryInClasspath>true</includeConfigurationDirectoryInClasspath>
       <binFileExtensions>
        <unix>.sh</unix>
       </binFileExtensions>
       <platforms>
        <platform>unix</platform>
       </platforms>
       <programs>
        <program>
         <name>start0</name>
         <mainClass>gravity.framework.core.ApplicationContextGateway</mainClass>
         <platforms>
          <platform>windows</platform>
          <platform>unix</platform>
         </platforms>
        </program>
       </programs>
      </configuration>
      <goals>
       <goal>assemble</goal>
      </goals>
     </execution>
    </executions>
   </plugin> 

[ERROR] Failed to execute goal org.codehaus.mojo:appassembler-maven-plugin:1.1.1:assemble (new-start-script) on project child-ticketing: Failed to copy artifact. Failed to install artifact xxx: xxx\classes (Access is denied) -> [Help 1]

 

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:appassembler-maven-plugin:1.1.1:assemble (new-start-script) on project xxx: Failed to copy artifact.

 

 

if appassembler's execution is bound to the package phase - instead of generate-resources, the original test case works

 

Number of attachments :
4

Description

With Workspace resolution enabled in Eclipse Ganymede RC2, and the appassembler mojo in a module of a multi-module project - the following error occured while installing jars into the appassembler target lib.
The following mojo encountered an error while executing:
Group-Id: org.codehaus.mojo
Artifact-Id: appassembler-maven-plugin
Version: 1.0
Mojo: assemble
brought in via: POM

While building project:
Group-Id: package.name.changed.rcu.fdmd
Artifact-Id: package.name.changed.rcu.fdmd
Version: 1.0-SNAPSHOT
From file: C:\devel\workspaces\ganymede-sr2-workspace\fdio-rcu\fdmd\pom.xml
Reason: Failed to copy artifact.

org.apache.maven.artifact.installer.ArtifactInstallationException: Error installing artifact:

C:\devel\workspaces\ganymede-sr2-workspace\fdio-rcu\common\target\classes (Access is denied)

As a work around, I disabled workspace resolution and appassembler worked as expected, however I noticed that a difference on the Installing printout. With workspace resolution turned off, appassembler correctly attempts to copy the correct jar. With workspace resolution turned on, appassembler attempts to copy the classes associated to the module - which I believe to be incorrect, and the reason why the copy failed.

I have included the full printout from the console.

  1. appassembler_debug.txt
    02/Apr/09 6:26 PM
    3 kB
    Joseph S. Butler
  2. appassembler-without-workspace-resolution.txt
    11/May/09 3:43 AM
    25 kB
    Henrik Dohlmann
  3. appassembler-with-workspace-resolution.txt
    11/May/09 3:43 AM
    21 kB
    Henrik Dohlmann

Activity

Hide
Henrik Dohlmann added a comment - 11/May/09 3:34 AM

Same problem for me: Eclipse 3.4.2, m2eclipse 0.9.8, appassembler-maven-plugin 1.0.
Same workaround: Disable Workspace Resolution.

Attaching console output with and without Workspace Resolution enabled.

Snippet of log when Workspace resolution is enabled:

[INFO] [appassembler:create-repository]
[INFO] Installing artifact C:\Users\hdohlmann\.m2\repository\log4j\log4j\1.2.14\log4j-1.2.14.jar to D:\3dwork\acadGenerator\acadGenerator-installer\target\staging\jsw\AcadGenerator\lib\log4j-1.2.14.jar
[INFO] Installing artifact D:\3dwork\jobAgent\jobAgent-main\target\classes to D:\3dwork\acadGenerator\acadGenerator-installer\target\staging\jsw\AcadGenerator\lib\jobAgent-main-1.0.0-SNAPSHOT.jar
[ERROR]

The following mojo encountered an error while executing:
Group-Id: org.codehaus.mojo
Artifact-Id: appassembler-maven-plugin
Version: 1.0
Mojo: create-repository
brought in via: POM

While building project:
Group-Id: com._3dfacto
Artifact-Id: acadGenerator-installer
Version: 1.0.0-SNAPSHOT
From file: D:\3dwork\acadGenerator\acadGenerator-installer\pom.xml
Reason: Failed to copy artifact

Show
Henrik Dohlmann added a comment - 11/May/09 3:34 AM Same problem for me: Eclipse 3.4.2, m2eclipse 0.9.8, appassembler-maven-plugin 1.0. Same workaround: Disable Workspace Resolution. Attaching console output with and without Workspace Resolution enabled. Snippet of log when Workspace resolution is enabled: [INFO] [appassembler:create-repository] [INFO] Installing artifact C:\Users\hdohlmann\.m2\repository\log4j\log4j\1.2.14\log4j-1.2.14.jar to D:\3dwork\acadGenerator\acadGenerator-installer\target\staging\jsw\AcadGenerator\lib\log4j-1.2.14.jar [INFO] Installing artifact D:\3dwork\jobAgent\jobAgent-main\target\classes to D:\3dwork\acadGenerator\acadGenerator-installer\target\staging\jsw\AcadGenerator\lib\jobAgent-main-1.0.0-SNAPSHOT.jar [ERROR] The following mojo encountered an error while executing: Group-Id: org.codehaus.mojo Artifact-Id: appassembler-maven-plugin Version: 1.0 Mojo: create-repository brought in via: POM While building project: Group-Id: com._3dfacto Artifact-Id: acadGenerator-installer Version: 1.0.0-SNAPSHOT From file: D:\3dwork\acadGenerator\acadGenerator-installer\pom.xml Reason: Failed to copy artifact
Hide
Henrik Dohlmann added a comment - 11/May/09 3:43 AM

Console output of appassembler-maven-plugin:1.0:create-repository

Show
Henrik Dohlmann added a comment - 11/May/09 3:43 AM Console output of appassembler-maven-plugin:1.0:create-repository
Hide
Scott Bellamy added a comment - 27/Jan/10 2:43 PM

Any updates on the root cause of this issue? I have encountered this in Galileo as well, but have seen co-workers with the same versions have no issues.

Show
Scott Bellamy added a comment - 27/Jan/10 2:43 PM Any updates on the root cause of this issue? I have encountered this in Galileo as well, but have seen co-workers with the same versions have no issues.
Hide
Lukasz Szelag added a comment - 17/Feb/12 1:14 PM - edited

I found out that this issue is not necessarily specific to Eclipse, as I'm getting the same error from the command line.

Nevertheless, the above error occurs only when running the build on Linuxcorrected below and works on Windows. Eclipse is not even installed on the Linux server.

Windows 7 SP1
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.7.0_01
Java home: C:\programs\jse-1.7.0_01\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
Linux Ubuntu 2.6.18-238.12.1.el5
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.7.0
Java home: /data/riskengine2/jse-1.7.0/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.18-238.12.1.el5" arch: "amd64" Family: "unix"
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
Show
Lukasz Szelag added a comment - 17/Feb/12 1:14 PM - edited I found out that this issue is not necessarily specific to Eclipse, as I'm getting the same error from the command line. Nevertheless, the above error occurs only when running the build on Linux corrected below and works on Windows. Eclipse is not even installed on the Linux server.
Windows 7 SP1
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.7.0_01
Java home: C:\programs\jse-1.7.0_01\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7" version: "6.1" arch: "amd64" Family: "windows"

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
Linux Ubuntu 2.6.18-238.12.1.el5
Apache Maven 2.2.1 (r801777; 2009-08-06 15:16:01-0400)
Java version: 1.7.0
Java home: /data/riskengine2/jse-1.7.0/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.18-238.12.1.el5" arch: "amd64" Family: "unix"
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
Hide
Karl Heinz Marbaise added a comment - 17/Feb/12 1:45 PM

Can you add an example project which reproduces this behavior..

Show
Karl Heinz Marbaise added a comment - 17/Feb/12 1:45 PM Can you add an example project which reproduces this behavior..
Hide
Lukasz Szelag added a comment - 23/Feb/12 8:20 AM - edited

I did some more testing and found out that the above error shows up when generating a site (mvn site). This is not isolated to Linux as I assumed before (we generate site only from the Linux build server, not from a Windows-based developer PC). Building and deploying the artifact works without an error (mvn clean deploy).

mvn -Dplugin=site help:describe
Name: Maven Site Plugin 3
Description: The Maven Site Plugin is a plugin that generates a site for the
  current project.
Group Id: org.apache.maven.plugins
Artifact Id: maven-site-plugin
Version: 3.0

Also (I'm not sure if that matters), but the appassembler plugin goals are invoked from genenerate-resources phase.

When I have some more time I will try to recreate this issue and then will post an example project.

Show
Lukasz Szelag added a comment - 23/Feb/12 8:20 AM - edited I did some more testing and found out that the above error shows up when generating a site ( mvn site). This is not isolated to Linux as I assumed before (we generate site only from the Linux build server, not from a Windows-based developer PC). Building and deploying the artifact works without an error ( mvn clean deploy).
mvn -Dplugin=site help:describe
Name: Maven Site Plugin 3
Description: The Maven Site Plugin is a plugin that generates a site for the
  current project.
Group Id: org.apache.maven.plugins
Artifact Id: maven-site-plugin
Version: 3.0
Also (I'm not sure if that matters), but the appassembler plugin goals are invoked from genenerate-resources phase. When I have some more time I will try to recreate this issue and then will post an example project.
Hide
Lukasz Szelag added a comment - 24/Feb/12 9:51 AM

A test case for reproducing the problem.

Show
Lukasz Szelag added a comment - 24/Feb/12 9:51 AM A test case for reproducing the problem.
Hide
Lukasz Szelag added a comment - 24/Feb/12 9:51 AM

Attached is a sample project that can be used to reproduce this issue.

mvn -e clean site
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - test:appassembler-test:jar:1.0-SNAPSHOT
[INFO]    task-segment: [clean, site]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory C:\eclipse-workspaces\main\appassembler-test\target
[INFO] Preparing cobertura:cobertura
[INFO] [appassembler:generate-daemons {execution: create-test-daemon}]
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\eclipse-workspaces\main\appassembler-test\src\main\resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to C:\eclipse-workspaces\main\appassembler-test\target\classes
[INFO] [cobertura:instrument {execution: default-instrument}]
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 1 file to C:\eclipse-workspaces\main\appassembler-test\target\generated-classes\cobertura
Cobertura: Saved information on 1 classes.
Instrument time: 86ms

[INFO] Instrumentation was successful.
[INFO] NOT adding cobertura ser file to attached artifacts list.
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - test:appassembler-test:jar:1.0-SNAPSHOT
[INFO]    task-segment: [clean, site]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory C:\eclipse-workspaces\main\appassembler-test\target
[INFO] Preparing cobertura:cobertura
[INFO] [appassembler:generate-daemons {execution: create-test-daemon}]
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\eclipse-workspaces\main\appassembler-test\src\main\resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to C:\eclipse-workspaces\main\appassembler-test\target\classes
[INFO] [cobertura:instrument {execution: default-instrument}]
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 1 file to C:\eclipse-workspaces\main\appassembler-test\target\generated-classes\cobertura
Cobertura: Saved information on 1 classes.
Instrument time: 88ms

[INFO] Instrumentation was successful.
[INFO] NOT adding cobertura ser file to attached artifacts list.
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\eclipse-workspaces\main\appassembler-test\src\test\resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] No sources to compile
[INFO] [surefire:test {execution: default-test}]
[INFO] No tests to run.
[INFO] Preparing jdepend:generate
[INFO] Installing C:\eclipse-workspaces\main\appassembler-test\target\classes to C:\eclipse-workspaces\main\appassembler-test\target\generated-r
esources\appassembler\jsw\test\lib\test\appassembler-test\1.0-SNAPSHOT\appassembler-test-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to copy artifact.

Embedded error: Error installing artifact: C:\eclipse-workspaces\main\appassembler-test\target\classes (Access is denied)
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to copy artifact.
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:1205)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:1038)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:663)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        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:601)
        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: Failed to copy artifact.
        at org.codehaus.mojo.appassembler.GenerateDaemonsMojo.installArtifact(GenerateDaemonsMojo.java:302)
        at org.codehaus.mojo.appassembler.GenerateDaemonsMojo.execute(GenerateDaemonsMojo.java:275)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 21 more
Caused by: org.apache.maven.artifact.installer.ArtifactInstallationException: Error installing artifact: C:\eclipse-workspaces\main\appassembler
-test\target\classes (Access is denied)
        at org.apache.maven.artifact.installer.DefaultArtifactInstaller.install(DefaultArtifactInstaller.java:119)
        at org.codehaus.mojo.appassembler.GenerateDaemonsMojo.installArtifact(GenerateDaemonsMojo.java:297)
        ... 24 more
Caused by: java.io.FileNotFoundException: C:\eclipse-workspaces\main\appassembler-test\target\classes (Access is denied)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at hidden.org.codehaus.plexus.util.io.FileInputStreamFacade.getInputStream(FileInputStreamFacade.java:39)
        at hidden.org.codehaus.plexus.util.FileUtils.copyStreamToFile(FileUtils.java:1106)
        at hidden.org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1013)
        at org.apache.maven.artifact.installer.DefaultArtifactInstaller.install(DefaultArtifactInstaller.java:98)
        ... 25 more

Interestingly, after commenting out both cobertura-maven-plugin and jdepend-maven-plugin, the build is successfull. Also, I tested this scenario using other reporting plugins (see below) and didn't encounter this problem.

These plugins don't cause an error
<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
				<version>2.8</version>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-project-info-reports-plugin</artifactId>
				<version>2.4</version>
				<reportSets>
					<reportSet>
						<reports>
							<report>index</report>
							<report>project-team</report>
							<report>dependencies</report>
							<report>issue-tracking</report>
							<report>scm</report>
							<report>distribution-management</report>
						</reports>
					</reportSet>
				</reportSets>
				<configuration>
					<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
					<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
				</configuration>				
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jxr-plugin</artifactId>
				<version>2.3</version>
			</plugin>			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-pmd-plugin</artifactId>
				<version>2.5</version>
				<configuration>
					<linkXref>true</linkXref>
					<targetJdk>1.5</targetJdk>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-report-plugin</artifactId>
				<version>2.9</version>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>taglist-maven-plugin</artifactId>
				<version>2.4</version>			 			
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>findbugs-maven-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<threshold>Default</threshold>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>javancss-maven-plugin</artifactId>
				<version>2.0</version>
			</plugin>
		</plugins>
	</reporting>

Further, if appassembler's execution is bound to the package phase - instead of generate-resources, the original test case works. I hope the above will help to track down the root cause.

Show
Lukasz Szelag added a comment - 24/Feb/12 9:51 AM Attached is a sample project that can be used to reproduce this issue.
mvn -e clean site
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - test:appassembler-test:jar:1.0-SNAPSHOT
[INFO]    task-segment: [clean, site]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory C:\eclipse-workspaces\main\appassembler-test\target
[INFO] Preparing cobertura:cobertura
[INFO] [appassembler:generate-daemons {execution: create-test-daemon}]
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\eclipse-workspaces\main\appassembler-test\src\main\resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to C:\eclipse-workspaces\main\appassembler-test\target\classes
[INFO] [cobertura:instrument {execution: default-instrument}]
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 1 file to C:\eclipse-workspaces\main\appassembler-test\target\generated-classes\cobertura
Cobertura: Saved information on 1 classes.
Instrument time: 86ms

[INFO] Instrumentation was successful.
[INFO] NOT adding cobertura ser file to attached artifacts list.
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - test:appassembler-test:jar:1.0-SNAPSHOT
[INFO]    task-segment: [clean, site]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory C:\eclipse-workspaces\main\appassembler-test\target
[INFO] Preparing cobertura:cobertura
[INFO] [appassembler:generate-daemons {execution: create-test-daemon}]
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\eclipse-workspaces\main\appassembler-test\src\main\resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to C:\eclipse-workspaces\main\appassembler-test\target\classes
[INFO] [cobertura:instrument {execution: default-instrument}]
[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 1 file to C:\eclipse-workspaces\main\appassembler-test\target\generated-classes\cobertura
Cobertura: Saved information on 1 classes.
Instrument time: 88ms

[INFO] Instrumentation was successful.
[INFO] NOT adding cobertura ser file to attached artifacts list.
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\eclipse-workspaces\main\appassembler-test\src\test\resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] No sources to compile
[INFO] [surefire:test {execution: default-test}]
[INFO] No tests to run.
[INFO] Preparing jdepend:generate
[INFO] Installing C:\eclipse-workspaces\main\appassembler-test\target\classes to C:\eclipse-workspaces\main\appassembler-test\target\generated-r
esources\appassembler\jsw\test\lib\test\appassembler-test\1.0-SNAPSHOT\appassembler-test-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to copy artifact.

Embedded error: Error installing artifact: C:\eclipse-workspaces\main\appassembler-test\target\classes (Access is denied)
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to copy artifact.
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:1205)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:1038)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:663)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        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:601)
        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: Failed to copy artifact.
        at org.codehaus.mojo.appassembler.GenerateDaemonsMojo.installArtifact(GenerateDaemonsMojo.java:302)
        at org.codehaus.mojo.appassembler.GenerateDaemonsMojo.execute(GenerateDaemonsMojo.java:275)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 21 more
Caused by: org.apache.maven.artifact.installer.ArtifactInstallationException: Error installing artifact: C:\eclipse-workspaces\main\appassembler
-test\target\classes (Access is denied)
        at org.apache.maven.artifact.installer.DefaultArtifactInstaller.install(DefaultArtifactInstaller.java:119)
        at org.codehaus.mojo.appassembler.GenerateDaemonsMojo.installArtifact(GenerateDaemonsMojo.java:297)
        ... 24 more
Caused by: java.io.FileNotFoundException: C:\eclipse-workspaces\main\appassembler-test\target\classes (Access is denied)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at hidden.org.codehaus.plexus.util.io.FileInputStreamFacade.getInputStream(FileInputStreamFacade.java:39)
        at hidden.org.codehaus.plexus.util.FileUtils.copyStreamToFile(FileUtils.java:1106)
        at hidden.org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1013)
        at org.apache.maven.artifact.installer.DefaultArtifactInstaller.install(DefaultArtifactInstaller.java:98)
        ... 25 more
Interestingly, after commenting out both cobertura-maven-plugin and jdepend-maven-plugin, the build is successfull. Also, I tested this scenario using other reporting plugins (see below) and didn't encounter this problem.
These plugins don't cause an error
<reporting>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
				<version>2.8</version>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-project-info-reports-plugin</artifactId>
				<version>2.4</version>
				<reportSets>
					<reportSet>
						<reports>
							<report>index</report>
							<report>project-team</report>
							<report>dependencies</report>
							<report>issue-tracking</report>
							<report>scm</report>
							<report>distribution-management</report>
						</reports>
					</reportSet>
				</reportSets>
				<configuration>
					<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
					<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
				</configuration>				
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jxr-plugin</artifactId>
				<version>2.3</version>
			</plugin>			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-pmd-plugin</artifactId>
				<version>2.5</version>
				<configuration>
					<linkXref>true</linkXref>
					<targetJdk>1.5</targetJdk>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-report-plugin</artifactId>
				<version>2.9</version>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>taglist-maven-plugin</artifactId>
				<version>2.4</version>			 			
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>findbugs-maven-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<threshold>Default</threshold>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>javancss-maven-plugin</artifactId>
				<version>2.0</version>
			</plugin>
		</plugins>
	</reporting>
Further, if appassembler's execution is bound to the package phase - instead of generate-resources, the original test case works. I hope the above will help to track down the root cause.
Hide
Karl Heinz Marbaise added a comment - 27/Feb/12 2:04 PM

After diving a little bit into this issue i found the root cause (hope so ) here (last line in execute method of GenerateDaemonsMojo):

installArtifact ( artifactRepository, projectArtifact );

whereas the projectArtifact is defined like the following:

/**
     * @readonly
     * @parameter expression="${project.artifact}"
     */
    private Artifact projectArtifact;

I'm not sure what can cause the problem in this case. I don't see a problem with this (Maven 2.2.1 vs. Maven 3.0.X) ?

Show
Karl Heinz Marbaise added a comment - 27/Feb/12 2:04 PM After diving a little bit into this issue i found the root cause (hope so ) here (last line in execute method of GenerateDaemonsMojo):
installArtifact ( artifactRepository, projectArtifact );
whereas the projectArtifact is defined like the following:
/**
     * @readonly
     * @parameter expression="${project.artifact}"
     */
    private Artifact projectArtifact;
I'm not sure what can cause the problem in this case. I don't see a problem with this (Maven 2.2.1 vs. Maven 3.0.X) ?
Hide
Lukasz Szelag added a comment - 28/Feb/12 8:16 AM - edited

I have only tested this using Maven 2.2.1 and don't know if this behaves differently with a different version.

I think that this is caused by the fact that the main artifact or project classes are not available (compiled/packaged yet) in the generate-resources phase, so the above construct fails. This works fine if appassembler goal is bound to the package phase.

Show
Lukasz Szelag added a comment - 28/Feb/12 8:16 AM - edited I have only tested this using Maven 2.2.1 and don't know if this behaves differently with a different version. I think that this is caused by the fact that the main artifact or project classes are not available (compiled/packaged yet) in the generate-resources phase, so the above construct fails. This works fine if appassembler goal is bound to the package phase.
Hide
Karl Heinz Marbaise added a comment - 15/Mar/12 1:13 PM

Do you have any objection to close the issue based on the differences in phase. I assume that the appassembler-plugin will be used in the package phase only or may be later but in my opinion it does not make sense to do it in earlier phases.

Show
Karl Heinz Marbaise added a comment - 15/Mar/12 1:13 PM Do you have any objection to close the issue based on the differences in phase. I assume that the appassembler-plugin will be used in the package phase only or may be later but in my opinion it does not make sense to do it in earlier phases.

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值