我们正在开发一个由几个插件组成的 Eclipse 产品,其中一些是我们开发的。我们的每个插件都被定义为工作区中的一个 Eclipse 插件项目,并且有两个文件夹,source 和 test。最近我注意到我们正在向用户提供测试类,就像我们的源类一样。现在我想从我们的产品结果中删除测试类。我是否应该从 Java 构建路径中删除测试文件夹(见附件)?我还应该怎么做才能不将我们的测试部署给最终用户?
为了构建项目,我们使用 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>