1
我试过像这样(link):如何使用ant4eclipse复制所有引用的eclipse项目的jar包?
<taskdef resource="net/sf/antcontrib/antlib.xml" />
<taskdef resource="net/sf/ant4eclipse/antlib.xml" />
<target name="copy_jars">
<getEclipseClasspath workspace="${basedir}/.."
projectname="MyProject"
property="classpath"
relative="false"
runtime="true"
pathseparator="#" />
<!-- iterate over all classpath entries -->
<foreach list="${classpath}" delimiter="#"
target="copy_jar_file" param="classpath.entry" />
</target>
<target name="copy_jar_file">
<!-- check if current is a .jar-file ... -->
<if>
<isfileselected file="${classpath.entry}">
<filename name="**/*.jar" />
</isfileselected>
<then>
<!-- copy the jar file to a destination directory -->
<copy file="${classpath.entry}" tofile="${dest.dir}"/>
</then>
</if>
</target>
但我得到异常:
[getEclipseClasspath] net.sf.ant4eclipse.model.FileParserException: Could not parse plugin project 'E:\...\MyProject' since it contains neither a Bundle-Manifest nor a plugin.xml!
[getEclipseClasspath] at net.sf.ant4eclipse.model.pdesupport.plugin.PluginDescriptorParser.parseEclipseProject(Unknown Source)
[getEclipseClasspath] at net.sf.ant4eclipse.model.pdesupport.plugin.PluginProjectRoleIdentifier.applyRole(Unknown Source)
[getEclipseClasspath] at net.sf.ant4eclipse.model.roles.RoleIdentifierRegistry.applyRoles(Unknown Source)
[getEclipseClasspath] at net.sf.ant4eclipse.tools.ProjectFactory.readProjectFromWorkspace(Unknown Source)
[getEclipseClasspath] at net.sf.ant4eclipse.tools.resolver.AbstractClasspathResolver.resolveEclipseClasspathEntry(Unknown Source)
[getEclipseClasspath] at net.sf.ant4eclipse.tools.resolver.AbstractClasspathResolver.resolveProjectClasspath(Unknown Source)
[getEclipseClasspath] at net.sf.ant4eclipse.tools.resolver.ProjectClasspathResolver.resolveProjectClasspath(Unknown Source)
[getEclipseClasspath] at net.sf.ant4eclipse.ant.task.project.GetEclipseClassPathTask.resolvePath(Unknown Source)
[getEclipseClasspath] at net.sf.ant4eclipse.ant.task.project.AbstractGetProjectPathTask.execute(Unknown Source)
[getEclipseClasspath] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[getEclipseClasspath] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[getEclipseClasspath] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[getEclipseClasspath] at java.lang.reflect.Method.invoke(Method.java:597)
[getEclipseClasspath] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[getEclipseClasspath] at org.apache.tools.ant.Task.perform(Task.java:348)
[getEclipseClasspath] at org.apache.tools.ant.Target.execute(Target.java:357)
[getEclipseClasspath] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[getEclipseClasspath] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[getEclipseClasspath] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[getEclipseClasspath] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[getEclipseClasspath] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
[getEclipseClasspath] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[getEclipseClasspath] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
[getEclipseClasspath] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
BUILD FAILED
E:\...\build.xml:132: Exception whilst resolving the classpath of project MyProject! Reason: Could not parse plugin project 'E:\...\MyProject' since it contains neither a Bundle-Manifest nor a plugin.xml!
我wan't只复制的罐子,而不是被引用的项目。 有没有办法参数化任务getEclipseClasspath,所以它只获取罐子,而不是项目?
我在重新输入错误时犯了一个错误:无法解析插件项目'E:\ ... \ MyReferencedProject',因为它既不包含Bundle-Manifest也不包含plugin.xml! 我试图从“MyProject”类路径中删除MyReferencedProject,然后复制所有罐子并正常工作。有没有人知道为什么它把“MyReferencedProject”作为一个插件项目?不是。 – davorp 2009-10-22 11:04:52
MyReferencedProject的类路径条目看起来像这样: 虽然一个罐子类路径条目看起来像: 我想过滤classpath条目,只需要那些kind =”lib“。 –
davorp
2009-10-22 11:10:14