我想在我的项目中使用一些liferay工件(2更改Jboss Portal 4 liferay,但这是另一个故事)。我从源码forge.net/proj ects / lportal / files / Liferay%20Portal / 6.1.0%20GA1 / liferay-portal-maven-6.1.0-ce-ga1-20120106155615760.zip / download下载maven liferay插件键入ant install auto会自动将liferay工件安装到maven存储库中(并没有更改build.xml中的任何内容,方向也是如此,我想将它安装到默认存储库USER / .m2中。所以我在cmd中输入ant instal -debug和i得到这个错误
install-artifact:
Class java.util.Vector loaded from parent loader (parentFirst)
Class org.apache.tools.ant.taskdefs.condition.Equals loaded from parent loader (
parentFirst)
[exec] Current OS is Windows 7
[exec] Executing 'mvn.bat' with arguments:
[exec] 'install:install-file'
[exec] '-DartifactId=portal-client'
[exec] '-Dfile=dist/portal-client.jar'
[exec] '-DgroupId=com.liferay.portal'
[exec] '-Djavadoc=dist/portal-client-javadoc.jar'
[exec] '-Dpackaging=jar'
[exec] '-DpomFile=dist/portal-client.pom'
[exec] '-Dsources=dist/portal-client-sources.jar'
[exec] '-Dversion=6.1.0'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
Execute:Java13CommandLauncher: Executing 'mvn.bat' with arguments:
'install:install-file'
'-DartifactId=portal-client'
'-Dfile=dist/portal-client.jar'
'-DgroupId=com.liferay.portal'
'-Djavadoc=dist/portal-client-javadoc.jar'
'-Dpackaging=jar'
'-DpomFile=dist/portal-client.pom'
'-Dsources=dist/portal-client-sources.jar'
'-Dversion=6.1.0'
The ' characters around the executable and arguments are
not part of the command.
[exec] [INFO] Scanning for projects...
[exec] [INFO] Searching repository for plugin with prefix: 'install'.
[exec] [INFO] -------------------------------------------------------------
-----------
[exec] [INFO] Building Maven Default Project
[exec] [INFO] task-segment: [install:install-file] (aggregator-style)
[exec] [INFO] -------------------------------------------------------------
-----------
[exec] [INFO] [install:install-file {execution: default-cli}]
[exec] [INFO] Installing C:\liferay-portal-maven-6.1.0\dist\portal-client.j
ar to C:\Users\Wro00427\.m2\repository\com\liferay\portal\portal-client\6.1.0\po
rtal-client-6.1.0.jar
[exec] [INFO] Installing C:\liferay-portal-maven-6.1.0\dist\portal-client.p
om to C:\Users\Wro00427\.m2\repository\com\liferay\portal\portal-client\6.1.0\po
rtal-client-6.1.0.pom
[exec] [INFO] -------------------------------------------------------------
-----------
[exec] [INFO] BUILD SUCCESSFUL
[exec] [INFO] -------------------------------------------------------------
-----------
[exec] [INFO] Total time: < 1 second
[exec] [INFO] Finished at: Wed Jul 11 10:12:03 CEST 2012
[exec] [INFO] Final Memory: 3M/254M
[exec] [INFO] -------------------------------------------------------------
-----------
[exec] 'cmd' is not recognized as an internal or external command,
[exec] operable program or batch file.
[antcall] Exiting C:\liferay-portal-maven-6.1.0\build.xml.
BUILD FAILED
C:\liferay-portal-maven-6.1.0\build.xml:221: The following error occurred while
executing this line:
C:\liferay-portal-maven-6.1.0\build.xml:271: exec returned: 1
at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:646)
at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:672)
at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:498)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a: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(Single
CheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a: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.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 2 seconds
我认为我有所有的envinorment变量,比如JAVA_HOME,ANT_HOME也是M2和M2_HOME,一切都在PATH中,即使我有MAVEN_OPTS。我从不使用蚂蚁我不知道2做什么。我尝试寻找答案,但在这个具体的例子中找不到这个错误(exec返回1)。
答案 0 :(得分:1)
我建议您安装一个Maven存储库管理器,如Nexus并在那里加载jar。大多数repo管理器都有一个GUI来帮助你加载所需的jar。
使用存储库管理器总是一个好主意!本地存储库实际上是一个缓存.....
在ANT构建结束时调用Maven命令行,将jar安装到本地存储库中,例如:
mvn install:install-file -Dfile=myapp.jar -DgroupId=?? -DartifactId=?? -Dversion=?? -Dpackaging=jar