我们正在开发一个由几个插件组成的Eclipse产品,其中一些插件是由我们开发的。我们的每个插件都被定义为工作区中的一个Eclipse插件项目,并且有两个文件夹,source和test。最近,我注意到我们正在向用户交付测试类,就像我们的源类一样。现在,我想从产品的结果中删除测试类。我应该从Java构建路径(见附件)中删除test文件夹吗?我还应该做些什么来避免将我们的测试部署到最终用户?

为了构建项目,我们使用eclipse标准ant脚本来创建zip文件。我找不到在哪里可以排除测试文件。下面是Ant脚本:
<property name="allElementsFile" value="${eclipse.pdebuild.scripts}/productBuild/allElements.xml"/>
<import file="${eclipse.pdebuild.scripts}/build.xml"/>
<property name="pluginPath" value=""/>
<property name="pluginList" value=""/>
<property name="featureList" value=""/>
<property name="includeLaunchers" value="true"/>
<property name="generatedBuildProperties" value=""/>
<condition property="nestedInclusions" value="true">
<istrue value="${p2.gathering}" />
</condition>
<!-- ===================================================================== -->
<!-- main entry point to setup, fetch, generate, build etc. Use -->
<!-- the customTargets.xml to modify the build behaviour. -->
<!-- ===================================================================== -->
<target name="main" description="the main build target">
<antcall target="preBuild" />
<antcall target="processRepos"/>
<antcall target="generateFeature"> <!-- Generate the feature to drive the fetch -->
<param name="verify" value="false"/>
</antcall>
<antcall target="fetch" />
<antcall target="generateFeature"> <!-- We are calling generate feature a second time so that we can get the pack / unpack clause fixed -->
<param name="verify" value="true"/>
</antcall>
<antcall target="generate" />
<antcall target="process" />
<antcall target="assemble" />
<antcall target="package" />
<antcall target="postBuild" />
</target>
<!-- ===================================================================== -->
<!-- Generate a container feature based on the product file -->
<!-- The plugin or feature containing the .product file will need to exist -->
<!-- already, use preSetup or postSetup to fetch it if necessary -->
<!-- ===================================================================== -->
<target name="generateFeature">
<eclipse.generateFeature
featureId="org.eclipse.pde.build.container.feature"
buildDirectory="${buildDirectory}"
baseLocation="${baseLocation}"
productFile="${product}"
verify="${verify}"
pluginPath="${transformedRepoLocation}${path.separator}${pluginPath}"
configInfo="${configs}"
pluginList="${pluginList}"
featureList="${featureList}"
includeLaunchers="${includeLaunchers}"
buildPropertiesFile="${generatedBuildProperties}"
nestedInclusions="${nestedInclusions}"
filterP2Base="${filterP2Base}"
/>
</target>
</project>发布于 2013-02-06 22:29:17
这是您的部署过程/脚本的问题。您是否正在使用Eclipse构建jar?它不应该与构建路径有关,如果您使用Eclipse对它们进行编码,那么您应该将测试源代码放在构建路径中。通常,使用Ant或Maven的部署过程将从结果中排除测试类(jar、war等)。在创建jar之前自动运行测试也是明智的。
发布于 2013-02-08 16:21:48
要在使用pde ant脚本构建pde项目时从代码中删除测试文件(如果您为每个插件项目定义了一个源文件夹和一个测试文件夹),您应该从该项目的build.properties中删除测试文件夹。build.properties是plugin.xml的一部分
https://stackoverflow.com/questions/14730824
复制相似问题