English 中文(简体)
将所有子夹中的java文档汇编起来? [复制]
原标题:Compiling java files in all subfolders? [duplicate]
  • 时间:2011-03-04 14:19:23
  •  标签:
  • java
  • javac

• 如何使用javac,将所有支离破碎的档案汇集在“Unix”的所有子里?

最佳回答

使用一个建筑工具,例如。 两者都比使用<条码>限制的<><>条码>UNIX工具”等工具更好地管理受扶养人。 而且,Maven也允许你确定除汇编外还要履行的习俗任务。 此外,还加入了管理边远存放所外部附属区的公约,以及支持持续一体化的操作单位测试和特征的公约。

即便您刚刚需要将自己的来源档案汇编成一页,你也可能会发现,建立一个简单的“Atbuild.xml<>。 档案最终可能是一个巨大的时间。

最后,大多数广域网和密码编辑应用程序与安特建文字进行某种整合,因此,你可以从编辑内部承担所有安特任务。 NetBeans ,,, IDEA,而且有更多的人支持Maven。

http://ant.apache.org/manual/index.html。 The following is the example Building file from thelink:

<project name="MyProject" default="dist" basedir=".">
    <description>
        simple example build file
    </description>
  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist"  location="dist"/>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>
  </target>

  <target name="dist" depends="compile"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>

    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
  </target>

  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>

一旦你熟悉安特,你就会发现更容易去马文。

问题回答

视窗

创建批号:

for /r %%a in (.) do (javac %%a*.java)

......在最高级别的消息来源中执行。

∗ 待印发。

javac $(find ./rootdir/* | grep .java)

这两处答案都是从现在起......

http://forums.oracle.com/forums/thread.jspa?threadID=1518437&tstart=<15/a>

但正如其他人所建议的那样,建筑工具可能证明是有用的。

我不知道这是否是最佳方法,但这项工作应当:

find . -name "*.java" | xargs javac

使用Ant 书写文字,汇编尽可能多的来源文件。

http://maven.apache.org/“rel=“nofollow”>,Maven(作为安文的更现代的替代办法)。

Use an IDE, like Eclipse (all IDEs I know will happily compile multiple source folders for you)

另一种(无弹性的)方式,如果你知道有多倍的层次:

* E/CN.6/2009/1。 */*/*/java ......

视你的损失而定,你可能不得不将非配对模式扩大为零,用<代码>shopt-s unglob。 例如,Im利用以下双壳功能在我的java档案中找到案文:

function jgrep ()
{
    (
      shopt -s nullglob
      egrep --color=ALWAYS -n "$@" *.tex *.java */*.java */*/*.java */*/*/*.java */*/*/*/*.java */*/*/*/*/*.java
    )
} 

jgrep String

但正如其他人所说的那样,实际上使用一种建筑工具。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签