2

我想在我的项目中使用一些 liferay 工件(2 更改 Jboss Portal 4 liferay,但这是另一个故事)。我从 forge.net/projects/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 并且我得到这个错误

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 

我认为我拥有所有环境变量,例如 JAVA_HOME、ANT_HOME 以及 M2 和 M2_HOME,而且一切都在 PATH 中,即使我有 MAVEN_OPTS。我从不使用 ant 我不知道 2 做什么。我尝试寻找答案,但在此特定示例中找不到此错误(exec return 1)。

4

1 回答 1

1

选项1:存储库管理器

我建议你安装一个像Nexus这样的 Maven 存储库管理器并在那里加载 jars。大多数 repo 管理器都有一个 GUI 来帮助您加载所需的 jar。

使用存储库管理器总是一个好主意!本地存储库真的是一个缓存......

选项2:安装插件

在 ANT 构建结束时调用 Maven 命令行以将 jar 安装到本地存储库中,例如:

mvn install:install-file -Dfile=myapp.jar -DgroupId=?? -DartifactId=?? -Dversion=?? -Dpackaging=jar
于 2012-07-11T19:39:22.693 回答