How to filter deployed code when exporting EAR from eclipse?

I have a basic web application (dynamic web project in eclipse) with an associated EAR project. I am trying to make sure my test junit code is not included in the EAR file for deployment.

In my web project, I have a source folder called "src" and one called "test". I need to save .class files from the "test" source folder OUT from EAR when I export it using eclipse.

I know this is trivial using ant, but it seems impossible to use eclipse .. right click on the project and export the ear file. test classes are always included.

If I manually edit the .setting / org.eclipse.wst.common.component.xml file to remove the tag associated with the test folder, it works, but if some other developers change anything related to the assembly path, it is restored. ..

I missed something obvious .. I searched googled like crazy but to no avail .. checked the eclipse docs and I'm at a loss.

+3
source share
2 answers

It does not seem so straightforward that bizarre. Here are some workarounds you could try.

. java - Java (, , , ). "" Java- . "" Java- , , , .

, , . , , . , , , .

+1

- , PDE, Eclipse 3.7. / Eclipse/OSGi java: src test

eclipse, .

.classpath

<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry export="false" kind="src" path="test"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry export="false" kind="lib" path="/thirdparty/junit/junit.jar"/>
    <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

this

, , build.properties, "" jar.

source.optimizing.jar = src/
#This doesn't contain test/ because we don't want it in the build.

bin.includes = META-INF/,\
               optimizing.jar
#The junit.jar is also exluded               

, .

+1

Source: https://habr.com/ru/post/1713458/


All Articles