2012-01-25 43 views
0

如果我将源文件夹添加为Java构建路径/库中的类文件夹,Eclipse会发出抱怨。将源文件夹包含在Eclipse中的类路径中

我需要这个GWT,需要源代码在类路径中。一种解决方案是手动将所有项目的源文件夹添加到启动配置的类路径中,但由于特定的原因,这不适合我。

另一个解决方案是告诉Eclipse将所有*.java文件复制到bin文件夹(就像它为其他资源所做的那样),但是我也无法做到这一点。

+0

什么是投诉? – Dave

+0

投诉:如何配置eclipse项目,以便运行它时,它不仅包含bin文件夹,还包含运行时类路径中的src文件夹。在启动配置中,我不想手动编辑类路径,因为项目依赖于许多其他项目(使用IvyDE),而且我不想将每个相关项目的源文件夹手动添加到启动配置中。 –

+0

Laf,GWT需要类路径中的java文件。 –

回答

1

您是否使用Google的GWT插件(http://code.google.com/eclipse/docs/getting_started.html)。尽管我没有使用它,但是我的一个同事确实如此,并且我相当确定它在类路径问题中处理这类java代码。

+0

我不是,但我会检查它并投票给你,如果是的话...... –

+0

它没有帮助:-( –

0

我已经找到了解决办法 - 到Ant构建添加指向下面的蚂蚁文件中的所有项目:

<project name="Copy Sources" basedir="." default="copy-src"> 
    <target name="copy-src"> 
     <copy todir="bin"> 
      <fileset dir="src" includes="**/*.java"/> 
     </copy> 
    </target> 
</project> 

我的.project文件看起来是这样的:

<?xml version="1.0" encoding="UTF-8"?> 
<projectDescription> 
    <name>my-project1</name> 
    <comment></comment> 
    <projects> 
    </projects> 
    <buildSpec> 
     <buildCommand> 
      <name>org.eclipse.jdt.core.javabuilder</name> 
      <arguments> 
      </arguments> 
     </buildCommand> 
     <buildCommand> 
      <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> 
      <triggers>auto,full,incremental,</triggers> 
      <arguments> 
       <dictionary> 
        <key>LaunchConfigHandle</key> 
        <value>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; 
&lt;launchConfiguration local=&quot;false&quot; path=&quot;/gwt-dev-support/Copy Sources.launch&quot;/&gt;</value> 
       </dictionary> 
       <dictionary> 
        <key>incclean</key> 
        <value>true</value> 
       </dictionary> 
      </arguments> 
     </buildCommand> 
    </buildSpec> 
    <natures> 
     <nature>org.eclipse.jdt.core.javanature</nature> 
    </natures> 
</projectDescription> 
相关问题