Error that occurs during Maven build:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar (default-jar) on project cc-distFS: Error assembling JAR: Failed to read filesystem attributes for: /home/user/trunk/src/cc-distFS/pom.xml: Failed to quote directory: '/home/user/trunk/src/cc-distFS/pom.xml': Error setting up environmental variables: NullPointerException -> [Help 1]
maven -X package
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleThreadedBuilder$1.call(LifecycleThreadedBuilder.java:167)
at org.apache.maven.lifecycle.internal.LifecycleThreadedBuilder$1.call(LifecycleThreadedBuilder.java:163)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error assembling JAR
at org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:237)
at org.apache.maven.plugin.jar.AbstractJarMojo.execute(AbstractJarMojo.java:255)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 13 more
Caused by: org.codehaus.plexus.archiver.ArchiverException: Failed to read filesystem attributes for: /home/user/trunk/src/cc-dto/pom.xml
at org.codehaus.plexus.archiver.ArchiveEntry.createFileEntry(ArchiveEntry.java:163)
at org.codehaus.plexus.archiver.AbstractArchiver.addFile(AbstractArchiver.java:404)
at org.codehaus.plexus.archiver.AbstractArchiver.addFile(AbstractArchiver.java:316)
at org.apache.maven.archiver.MavenArchiver.createArchive(MavenArchiver.java:526)
at org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:230)
... 16 more
Caused by: java.io.IOException: Failed to quote directory: '/home/user/trunk/src/cc-dto/pom.xml'
at org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributeUtils.getFileAttributesByPath(PlexusIoResourceAttributeUtils.java:256)
at org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributeUtils.getFileAttributes(PlexusIoResourceAttributeUtils.java:172)
at org.codehaus.plexus.archiver.ArchiveEntry.createFileEntry(ArchiveEntry.java:159)
... 20 more
Caused by: org.codehaus.plexus.util.cli.CommandLineException: Error setting up environmental variables
at org.codehaus.plexus.util.cli.Commandline.getEnvironmentVariables(Commandline.java:466)
at org.codehaus.plexus.util.cli.Commandline.execute(Commandline.java:628)
at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLineAsCallable(CommandLineUtils.java:140)
at org.codehaus.plexus.components.io.attributes.PlexusIoResourceAttributeUtils.getFileAttributesByPath(PlexusIoResourceAttributeUtils.java:247)
... 22 more
Caused by: java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:394)
at org.codehaus.plexus.util.cli.CommandLineUtils.getEnvFromSystem(CommandLineUtils.java:624)
at org.codehaus.plexus.util.cli.CommandLineUtils.getSystemEnvVars(CommandLineUtils.java:284)
at org.codehaus.plexus.util.cli.CommandLineUtils.getSystemEnvVars(CommandLineUtils.java:260)
at org.codehaus.plexus.util.cli.Commandline.addSystemEnvironment(Commandline.java:442)
at org.codehaus.plexus.util.cli.Commandline.getEnvironmentVariables(Commandline.java:462)
... 25 more
Anybody know what does it mean?
PS:
% mvn -v
Apache Maven 3.0.4 (r1232337; 2012-01-17 15:44:56+0700)
Maven home: /home/user/Applications/apache-maven
Java version: 1.6.0_27, vendor: Sun Microsystems Inc.
Java home: /home/user/Applications/jdk
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-26-generic-pae", arch: "i386", family: "unix"
% java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Server VM (build 20.2-b06, mixed mode)
pom.xml for module cc-distFS:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.uc</groupId>
<artifactId>cc</artifactId>
<version>TRUNK-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>${parent.groupId}</groupId>
<artifactId>cc-distFS</artifactId>
<packaging>jar</packaging>
<version>${parent.version}</version>
<name>${pom.artifactId}</name>
<dependencies>
<dependency>
<groupId>com.cc</groupId>
<artifactId>cc-lib</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
</dependencies>
PS: Bug disappeared after that I made fsck.
The first thing which is a little bit weird is this:
<groupId>${parent.groupId}</groupId>
<artifactId>cc-distFS</artifactId>
<packaging>jar</packaging>
<version>${parent.version}</version>
<name>${pom.artifactId}</name>
You should never use ${pom....} or ${parent.groupId}. You should ${project.groupId} etc. instead.
But if you have a parent the definition neither of the groupId nor of the version is needed cause it's inherited from your parent. In other words your snippet would look like this:
<parent>
<groupId>com.uc</groupId>
<artifactId>cc</artifactId>
<version>TRUNK-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>cc-distFS</artifactId>
<name>${project.artifactId}</name>
Furthermore a version like "TRUNK-SNAPSHOT" is not a real good choice. I would suggest to use something more like "1.0-SNAPSHOT" like the rules describe . And one more thing if you have a parent you don't need to define a relative path in your parent which results into the following:
<parent>
<groupId>com.uc</groupId>
<artifactId>cc</artifactId>
<version>TRUNK-SNAPSHOT</version>
</parent>
<artifactId>cc-distFS</artifactId>
<name>${project.artifactId}</name> <!-- I wouldn't do that -->
But what makes me really suspicion is the following:
Failed to read filesystem attributes for: /home/user/trunk/src/cc-dto/pom.xml
cause that's indicates that something is wrong with your pom.xml file or the directories ? (permissions ?) and the following is definitively a hint that something is wrong with your directories:
java.io.IOException: Failed to quote directory: '/home/user/trunk/src/cc-dto/pom.xml'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.