score:1
it doesn't seem to be directly possible, which is bizarre. here's a couple of workarounds you could try.
note i'd move the java files from the web project to a java project (this is probably a good practice to follow anyway). either way create another "test" java project and move the test sources to that project. your test project declares the "main" java project as a dependency so it has access to the types for testing, but isn't included in the war, so the test classes won't be deployed.
alternatively if you want to keep the sources in one project, you can configure the test project to use linked resources. i've posted another answer that shows how you can use linked resources to share source locations across projects. with this approach the test sources still aren't on the build path for the main project, so won't be bundled in the jar, but are physically located in the project so source control is simpler.
score:1
i'm doing something similar, except with pde, using eclipse 3.7. i am deploying eclipse/osgi plugins/bundles, and have two java source directories: src and test
i've tweaked the contents of two eclipse project files to separate test code from the build.
.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>
these changes were motivated by reading this
i don't know if this will apply to your situation, but i also had to modify a build.properties file, to exclude the results of compiling 'test' from the produced jar file.
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
when i build the entire project, the test files are completely absent.
Source: stackoverflow.com
Related Query
- How to filter deployed code when exporting EAR from eclipse?
- How to enable hot code swap while debugging in eclipse and jboss when both code and the ear being deployed are on different remote machines?
- How to enable hot code swap while debugging in eclipse and jboss when both code and the ear being deployed are on different remote machines?
- How to prevent debugger from stepping into Object class code in Eclipse when developing with Scala?
- How to include maven libs in war when exporting from eclipse
- Android NDK debugging in Eclipse - how to stop segfaults/SIGILL that only occur when stepping in native code
- How to debug Java code when using ANT script in Eclipse
- How to change auto-generated code when creating new class in Eclipse
- How to Create Flowchart from java source code in Eclipse
- How to prevent Eclipse from auto-importing packages when pasting code?
- How can I prevent Eclipse from supplying deprecated classes when importing?
- How to exclude files from Eclipse indexing (Static Code Analysis)?
- How can I keep Eclipse from filling in auto-completions when I type an opening parenthesis ('(')?
- How to build Eclipse JDT Core from source code via Git?
- "Could not find main method from given launch configuration" error when exporting jar from Eclipse
- How to disable Eclipse PDT auto-format code when pasting
- How to filter JUNIT Tests that are called from eclipse by source path
- How to ignore missing filter file error on pom.xml in Eclipse when using resource filtering?
- Commit failed: "Repository UUID '...' doesn't match expected UUID '...'" when committing to Google Code from Eclipse on Windows
- How can I prevent Eclipse from stepping into Java library code
- How to set up ProGuard in Eclipse when exporting a signed, obfuscated Android application?
- Eclipse Juno - Assertion Failed (Problems occurred when invoking code from plug-in: "org.eclipse.jface".)
- How to work with a bundle in eclipse when it was downloaded from AEM
- how to import source code into Eclipse from a jar file?
- Why do Eclipse use an older version of code when exporting a Runnable Jar?
- How to get src folder under project-root folder in github when staging from eclipse using egit
- How to rename a method/field from Eclipse when not declared
- Showing JUnit view in Eclipse when running tests from Code
- Prevent eclipse from auto import packages when copying source code between projects
- Android -- how does one filter console spam from Eclipse LogCat?
More Query from same tag
- cloudera hadoop : caused by: java.lang.ClassNotFoundException: org.apache.htrace.core.Tracer$Builder
- Setting an template in Eclipse
- Selenium Python (Import Error) Python-Selenium-Eclipse
- Does Snap SPARQL API exist?
- How to Log a Loop inside Eclipse Console (Java)
- Automatic WSDL Java Stub generation in Eclipse Workspace using Apache CXF and CXF Maven Plugin
- Decimal to binary convertor
- Different compile times between IntelliJ and Eclipse IDE
- Does an Eclipse CVS merge appear in the log view of a file?
- I'm getting this error in eclipse while using selenium Jar files:
- Two Eclispse projects -> One Eclipse Plug-in
- Eclipse when export runnable jar program doesn't work
- Java with Eclipse: Debug mode enabled?
- ***missing separator. Stop. While eclipse trying to run OS/161
- Java parsing XML document gives “Content not allowed in prolog” error
- can't call onactivity result function after child activity is finished
- Zend Studio 9: Remote Server and dot folders
- Eclipse showing new package inside existing package
- Which jar is missing?
- Differenet java version than the one i set in environment variable
- copying or renaming an android project in eclipse
- Where should test classes be stored in the project?
- Android program fails. No errors, no log cat. No clues
- Three.js - how to resolve syntax error on delete in Eclipse
- Hadoop Development Tools for Eclipse not installing in Eclipse
- Android How to slide row when previous row visibility set to Visible?
- JDK required for Eclipse Oxygen 3
- Suggestions on optimizing the EGit on Eclipse
- Is there any other way to sort numbers in ascending or descending order without using arrays?
- Using github issues as mylyn task repository?