Maven构建失败并且'不是有效目录'

时间:2014-03-27 14:28:20

标签: ant jenkins weblogic maven-3 osb

我正在尝试使用Jenkins构建一个maven项目(在cmd行同样失败!)我得到以下错误。我看不到任何权限问题,并尝试了几个权限更改,看看它是否是一个Linux端错误,但没有运气?有什么想法吗?

export:
     [echo] midleware.home = /u01/Oracle/Middleware
Property "export.log.dir" has not been set
     [echo] export log dir = ${export.log.dir}
     [java] Executing '/usr/java/jdk1.6.0_30/jre/bin/java' with arguments:
     [java] '-XX:MaxPermSize=256m'
     [java] '-Xmx768m'
     [java] '-Dsun.lang.ClassLoader.allowArraySyntax=true'
     [java] '-Dweblogic.home=/u01/Oracle/Middleware/wlserver_10.3'
     [java] '-Dharvester.home=/u01/Oracle/Middleware/osb_11/harvester'
     [java] '-Dosb.home=/u01/Oracle/Middleware/osb_11'
     [java] '-Dosgi.bundlefile.limit=500'
     [java] '-Dosgi.nl=en_US'
     [java] '-Dmiddleware.home=/u01/Oracle/Middleware'
     [java] '-Dosgi.logfile=/var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas/export.log'
     [java] '-jar'
     [java] '/u01/Oracle/Middleware/oepe/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar'
     [java] '-data'
     [java] '/var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas'
     [java] '-application'
     [java] 'com.bea.alsb.core.ConfigExport'
     [java] '-configProject'
     [java] 'ATAS_Configuration'
     [java] '-configJar'
     [java] '/var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas/target/atas-10.0.jar'
     [java] '-includeDependencies'
     [java] 'true'
     [java] '-debug'
     [java] 
     [java] The ' characters around the executable and arguments are
     [java] not part of the command.
      [ant] Exiting /var/lib/jenkins/workspace/01_export-atas-osbconfig/build/ant/osb-config-export.xml.

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.698s
[INFO] Finished at: Thu Mar 27 14:00:50 GMT 2014
[INFO] Final Memory: 9M/56M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (export-osb-configuration) on project atas: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /var/lib/jenkins/workspace/01_export-atas-osbconfig/build/ant/osb-config-export.xml:12: /u01/Oracle/Middleware/oepe is not a valid directory
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (export-osb-configuration) on project atas: An Ant BuildException has occured: The following error occurred while executing this line:
/var/lib/jenkins/workspace/01_export-atas-osbconfig/build/ant/osb-config-export.xml:12: /u01/Oracle/Middleware/oepe is not a valid directory
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
    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.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
    at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
    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.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
    at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
    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 hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    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: An Ant BuildException has occured: The following error occurred while executing this line:
/var/lib/jenkins/workspace/01_export-atas-osbconfig/build/ant/osb-config-export.xml:12: /u01/Oracle/Middleware/oepe is not a valid directory
    at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:283)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    ... 31 more
Caused by: /var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas/target/antrun/build-main.xml:9: The following error occurred while executing this line:
/var/lib/jenkins/workspace/01_export-atas-osbconfig/build/ant/osb-config-export.xml:12: /u01/Oracle/Middleware/oepe is not a valid directory
    at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:551)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:444)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:392)
    at org.apache.tools.ant.Target.performTasks(Target.java:413)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:270)
    ... 33 more
Caused by: /var/lib/jenkins/workspace/01_export-atas-osbconfig/build/ant/osb-config-export.xml:12: /u01/Oracle/Middleware/oepe is not a valid directory
    at org.apache.tools.ant.taskdefs.Java.setupWorkingDir(Java.java:855)
    at org.apache.tools.ant.taskdefs.Java.setupExecutable(Java.java:825)
    at org.apache.tools.ant.taskdefs.Java.fork(Java.java:788)
    at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:214)
    at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
    at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:392)
    at org.apache.tools.ant.Target.performTasks(Target.java:413)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
    ... 44 more
[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
[JENKINS] Archiving /var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas/pom.xml to uk.org.tlms.tlmsim.flows/atas/10.0/atas-10.0.pom
channel stopped

Finished: FAILURE

xml文件重新加载

<project name="osb-config-export" default="export">
    <property file="${export.properties.file}"/>

        <target name="delete-metadata">
                <delete dir="${workspace.dir}/.metadata"/>
        </target>

    <target name="export" depends="delete-metadata">
                <echo message="midleware.home = ${middleware.home}"/>
                <echo message="export log dir = ${export.log.dir}"/>
                <java dir="${middleware.home}/oepe" jar="${middleware.home}/oepe/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar"
                   fork="true"  failonerror="true" maxmemory="768m">
                        <jvmarg line="-XX:MaxPermSize=256m" />
                        <arg line="-data ${workspace.dir}"/>
                        <arg line="-application com.bea.alsb.core.ConfigExport"/>
                        <arg line="-configProject ${config.project}"/>
                        <!--<arg line="-configSubProjects ${config.subprojects}"/>-->
                        <arg line="-configJar ${config.jar}"/>
                        <arg line="-includeDependencies  ${config.includeDependencies}"/>
                        <arg line="-debug"/>
                        <sysproperty key="sun.lang.ClassLoader.allowArraySyntax" value="true"/>
                        <sysproperty key="weblogic.home" value="${middleware.home}/wlserver_10.3"/>
                        <sysproperty key="harvester.home" value="${middleware.home}/osb_11/harvester"/>
                        <sysproperty key="osb.home" value="${middleware.home}/osb_11"/>
                        <sysproperty key="osgi.bundlefile.limit" value="500"/>
                        <sysproperty key="osgi.nl" value="en_US"/>
                        <sysproperty key="middleware.home" value="${middleware.home}"/>
                        <!--sysproperty key="osgi.logfile" value="${export.log.dir}/export.log"/-->
                        <sysproperty key="osgi.logfile" value="${workspace.dir}/export.log"/>
        </java>
        </target>
</project>

2 个答案:

答案 0 :(得分:2)

好吧,正如你自己指出的那样,这就是错误:

[ERROR] /var/lib/jenkins/workspace/01_export-atas-osbconfig/build/ant/osb-config-export.xml:12: /u01/Oracle/Middleware/oepe is not a valid directory

您还说在命令行中发生了同样的错误,因此这不是Jenkins的用户权限,Jenkins环境变量或工作区的问题

您需要查看line 12 /var/lib/jenkins/workspace/01_export-atas-osbconfig/build/ant/osb-config-export.xml上的代码。请将该文件编辑为原始问题。

但似乎很明显,它无法访问/u01/Oracle/Middleware/oepe。当您打开命令提示符并执行cd /u01/Oracle/Middleware/oepe时会发生什么?

还有这个:
Property "export.log.dir" has not been set
我不知道你是否期待这个错误。看起来您需要提供额外的属性值。

编辑1:
因此,如果cd /u01/Oracle/Middleware/oepe在命令行中运行并且结构看起来很好,那么它可能是文件系统权限。尝试执行 maven 命令并在其前面加sudo。如果可行,那么我们需要仔细查看权限。

其次,尝试在java内的命令行上执行ant脚本之外的/u01/Oracle/Middleware/oepe命令:

/usr/java/jdk1.6.0_30/jre/bin/java -XX:MaxPermSize=256m -Xmx768m -Dsun.lang.ClassLoader.allowArraySyntax=true -Dweblogic.home=/u01/Oracle/Middleware/wlserver_10.3 -Dharvester.home=/u01/Oracle/Middleware/osb_11/harvester -Dosb.home=/u01/Oracle/Middleware/osb_11 -Dosgi.bundlefile.limit=500 -Dosgi.nl=en_US -Dmiddleware.home=/u01/Oracle/Middleware -Dosgi.logfile=/var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas/export.log -jar /u01/Oracle/Middleware/oepe/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -data /var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas -application com.bea.alsb.core.ConfigExport -configProject ATAS_Configuration -configJar /var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas/target/atas-10.0.jar -includeDependencies true -debug

答案 1 :(得分:0)

在这种情况下,我只提供一般性建议 - 尝试查明错误的来源。我们看到一个错误来自Maven,Maven Ant插件(我假设),Jenkins以及调用OSB导出的实际Java命令。首先将其分解为最简单的一个(只需自己调用java命令查看哪些有效),然后在其上面进行分层,直到找到破损发生的位置。

例如,我不知道登录到控制台的内容实际上是否与它正在调用的java命令相同,或者如果你正在通过猜测来记录自己:

 [java] Executing '/usr/java/jdk1.6.0_30/jre/bin/java' with arguments:
 [java] '-XX:MaxPermSize=256m'
 [java] '-Xmx768m'
 [java] '-Dsun.lang.ClassLoader.allowArraySyntax=true'
 [java] '-Dweblogic.home=/u01/Oracle/Middleware/wlserver_10.3'
 [java] '-Dharvester.home=/u01/Oracle/Middleware/osb_11/harvester'
 [java] '-Dosb.home=/u01/Oracle/Middleware/osb_11'
 [java] '-Dosgi.bundlefile.limit=500'
 [java] '-Dosgi.nl=en_US'
 [java] '-Dmiddleware.home=/u01/Oracle/Middleware'
 [java] '-Dosgi.logfile=/var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas/export.log'
 [java] '-jar'
 [java] '/u01/Oracle/Middleware/oepe/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar'
 [java] '-data'
 [java] '/var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas'
 [java] '-application'
 [java] 'com.bea.alsb.core.ConfigExport'
 [java] '-configProject'
 [java] 'ATAS_Configuration'
 [java] '-configJar'
 [java] '/var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas/target/atas-10.0.jar'
 [java] '-includeDependencies'
 [java] 'true'
 [java] '-debug'

首先,把它当作与Jenkins运行的用户一样自己调用。那会让你知道你是否能够称之为:

/usr/java/jdk1.6.0_30/jre/bin/java -XX:MaxPermSize=256m -Xmx768m -Dsun.lang.ClassLoader.allowArraySyntax=true -Dweblogic.home=/u01/Oracle/Middleware/wlserver_10.3 -Dharvester.home=/u01/Oracle/Middleware/osb_11/harvester -Dosb.home=/u01/Oracle/Middleware/osb_11 -Dosgi.bundlefile.limit=500 -Dosgi.nl=en_US -Dmiddleware.home=/u01/Oracle/Middleware -Dosgi.logfile=/var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas/export.log -jar /u01/Oracle/Middleware/oepe/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar -data /var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas -application com.bea.alsb.core.ConfigExport -configProject ATAS_Configuration -configJar /var/lib/jenkins/workspace/01_export-atas-osbconfig/osbflows/atas/target/atas-10.0.jar -includeDependencies true -debug

然后,调用作为Jenkins用户

执行该操作的ant脚本

然后,将Maven插件称为Jekins用户,

然后Jenkins本身

不要走下到最简单的解决方案,从那里开始走路。