質問

すべてのJavaプロジェクトからのいずれかを使MavenはAnt.いや豪雨で、地滑りや洪水などのツールやと思うのにちょうど約あらゆるプロジェクトが利用できます。もう起こったこと ?で使用される様々な非Javaプロジェクトの簡単に取り扱うことができJava.を下回る可能性があります。ダウンロードmake.exe Windowsをご利用の場合、Ant、Mavenもんを推奨します。

はいはいくつかの基本的な欠陥になっているところもあるがJava?はそれだけでなAnt、MavenがJavaで記述された?

役に立ちましたか?

解決

メイクと

根本的な問題とJavaは、それはあなたが、その依存関係を解決するためのルールを依存関係を指定し、持っている前提に作品を作ります。

であります

"CC main.cの「実行main.oファイルにmain.cのファイルを変換するには、" 一般的に、基本的なC、と。

あなたはJavaでそれを行うことができますが、あなたはすぐに何かを学ぶます。

javacコンパイラの起動が遅いほとんどという。

違います:

javac Main.java
javac This.java
javac That.java
javac Other.java

javac Main.java This.java That.java Other.java

昼と夜である。

クラスの何百ものことを悪化させ、そしてそれだけで理不尽になります。

次に、あなたはJavaはCや平坦な構造に向かう傾向がある他の人対、ディレクトリ内のファイルのグループとして組織化される傾向にあるという事実であることを兼ね備えています。ファイルの階層での作業に多くの直接的なサポートを持っていないことを確認します。

また、コレクションレベルで、ファイルが古くなっているかを決定で非常に良好でないことを確認します。

アリで、それが通過し、古くなっているファイルのすべてを合計して、一度にそれらをコンパイルします。単に個々のファイルに対してJavaコンパイラを呼び出しますしてください。これをしない作る持つことはかなりアップタスクにないことを確認し、実際にショーに十分な外部ツールを必要とします。

AntとMavenのような選択肢が立ち上がった理由

それがあります。

他のヒント

由緒あるmakeプログラムは、個別に合理的にC ++やCのような言語をコンパイル処理します。あなたはそれがファイルを含む他のテキストに引っ張って#includeを使用し、出力として単一のオブジェクトファイルを書き込み、モジュールをコンパイルします。コンパイラは、実行可能バイナリにオブジェクトファイルを結合する別個の連結ステップと、非常に1つずつのシステムである。

しかし、Javaでは、コンパイラはimportとインポートのコンパイルの他のクラス、実際に持っています。それはそのmakeが一度に正しい順序1のクラスを構築しますので、Javaソースコードから必要なすべての依存関係を生成した何かを書くことが可能であろうが、これはまだ、このような循環依存関係としてケースを処理しません。

Javaコンパイラは、すでにコンパイルされたものの結果に依存し、さらにクラスをコンパイルしながら、他のクラスのコンパイル結果をキャッシュすることにより、より効率的にすることができます。依存関係の自動評価のこの種単独でmakeで本当にできません。

質問が間違った仮定に基づいている:開発者の非自明数は、<全角> の利用makeを行います。 Mavenの Javaのビルドツールを参照してください。 A>。なぜ開発者のでしょうではないの利用make:多くの開発者のいずれかがmakeを使用していない、またはそれを使用し、ア・サウザンド・サンズよりも熱く燃える火でそれを嫌ったことがありません。そのように、彼らは別のツールを使用します。

実際には、すべての古くなったjavaファイルの1つのコマンドで再コンパイルを処理することができます。あなたは、ディレクトリ内のすべてのファイルをコンパイルするか、特定の順序を希望したくない場合は最初の行を変更...

JAVA_FILES:=$(wildcard *.java)
#
# the rest is independent of the directory
#
JAVA_CLASSES:=$(patsubst %.java,%.class,$(JAVA_FILES))

.PHONY: classes
LIST:=

classes: $(JAVA_CLASSES)
        if [ ! -z "$(LIST)" ] ; then \
                javac $(LIST) ; \
        fi

$(JAVA_CLASSES) : %.class : %.java
        $(eval LIST+=$$<)

各の技術的なメリットについての他のすべての答えは真です。 AntMavenが作るよりも、Javaのに適しであってもよいし、ハンクゲイが指摘するように、彼らがいない場合があります)。

AntとMavenのはJavaで書かれていることを重要場合は、

しかし、あなたが尋ねました。 StackOverflowの上で我々は、このような思考(閉じた!ないプログラミング関連の!など)、THINGの一部でCOURSE OFを考慮していませんが。レールで私達は、レーキを使用するC男はmakeを使用し、Javaで私たちは、AntとMavenを使用しています。あなたがAntタスクを作成する何をすべきか:それはアリやMavenの開発者は他よりも、おそらくより良いJava開発者の世話になることは事実だが、また別の質問がありますか? Javaの。あなたはJava開発者であれば、それは簡単にフィット感です。

そうそう、それの一部は、あなたがツーリングしている言語で書かれたツールを使用することです。

(プロセスで新しいものを作成中)

AntとMavenの後には、それだけの進化であるMakeによって引き起こされるいくつかの頭痛を解決するために設計されていた。

  

...その後すぐに、いくつかのオープンソースのJavaプロジェクトはAntが、彼らはメイクファイルとしていた問題を解決することができることを実現....

http://ant.apache.org/faq.html#historyするから

彼らは何も解決したり、単に学ぶために余分なフォーマットを作成するかどうかは主観的なトピックです。作成者は、それが多くの問題を解決し、元のユーザーがこれらの美徳と言う言葉:真実は、それはほとんどすべての新しい発明の歴史だです。

主な利点は、Javaのと統合する可能性があるしています。

私は、同様の歴史は例えばrakeになりますね。

Mavenの(とアイビー対応Antのセットアップ)によって解決の主要な問題の

ワンメイクの上に依存関係のjarファイルの依存関係の解決およびダウンロードを自動化されます。

ると思うが、そのいくつかの要因意欲を利用することになるでしょう内のJavaコミュニティで臨界期の時間は、1990年代後半):

  1. でJavaを網羅マルチプラットフォームは、Javaプログラマが一般的ではありませんでした得意Unixのツールとしてたプログラマが一般的に限定されたUnix環境で(例えば、C、Perlプログラマー).これはます。なあとから贈られたJavaプログラマーとの深く理解します。
  2. してもほとんど減少しなかった得意としたかったのに使う。
  3. を記述することが可能で、一定のルールがMakefileを編集するJavaを効率的に細心の注意が必要なプラットフォームにより異なる。
  4. その結果が意欲的プラットフォームの構築ツールです。
  5. この環境Ant後にMavenが作成されます。

短いながらも確実に使用できるためのJavaプロジェクトがありました瞬間の機会で事実上のJavaのビルドツールです。その瞬間が経過しました。

スクリプトは、本質的にプラットフォームに依存する傾向があることを確認します。 Javaがプラットフォームに依存しないことになっています。したがって、唯一のマルチプラットフォームの基本ソースのための単一のプラットフォーム上で動作ビルドシステムを持つことは、問題をkindofがされています。

私は誰誰が(MIS)は、Javaが間違っているために作る使用されていない仮定午前ない限り。

「GNUプロジェクトの管理と作成」(GFDLの下で利用可能)Javaプロジェクトでmakeを使用して専用の完全な章が含まれています。

それはあなたがそこに見てみたいかもしれない他のツールの代わりに使用して作るの長所と短所の長い(そして、できれば公正)のリストが含まれています。 (参照: http://oreilly.com/catalog/make3/book/する

Short answer: Because make isn't good. Even on the C front you see many alternatives popping up.

Long answer: make has several flaws that make it barely suitable for compiling C, and unsuitable at all for compiling Java. You can force it to compile Java, if you want, but expect running into issues, some of which do not have a suitable solution or workaround. Here are a few:

Dependency resolution

make inherently expects files to have a tree-like dependency on each other, in which one file is the output of building several others. This already backfires in C when dealing with header files. make requires a make-specific include file to be generated to represent the dependency of a C file on its header files, so a change to the latter would cause the prior to be rebuilt. However, since the C file itself isn't recreated (merely rebuilt), make often requires specifying the target as .PHONY. Fortunately, GCC supports generating those files automatically.

In Java, dependency can be circular, and there's no tool for auto-generating class dependencies in make format. ant's Depend task can, instead, read the class file directly, determine which classes it imports, and delete the class file if any of them are out of date. Without this, any non-trivial dependency may result in you being forced to use repeated clean builds, removing any advantage of using a build tool.

Spaces in filenames

While neither Java nor C encourage using spaces in your source code filenames, in make this can be problem even if the spaces are in the file path. Consider, for example, if your source code exists in C:\My Documents\My Code\program\src. This would be enough to break make. This is because make treats filenames as strings. ant treats paths as special objects.

Scanning files for build

make requires explicitly setting which files are to be built for each target. ant allows specifying a folder which is to be auto-scanned for source files. It may seem like a minor convenience, but consider that in Java each new class requires a new file. Adding files to the project can become a big hassle fast.

And the biggest problem with make:

make is POSIX-dependent

Java's motto is "compile once run everywhere". But restricting that compilation to POSIX-based systems, in which Java support is actually the worst, is not the intention.

Build rules in make are essentially small bash scripts. Even though there is a port of make to Windows, for it to work properly, it has to be bundled with a port of bash, which includes a POSIX emulation layer for the file system.

This comes in two varieties:

  1. MSYS which tries to limit the POSIX translation to file paths, and can therefore have unpleasant gotchas when running external tools not made especially for it.

  2. cygwin which provides a complete POSIX emulation. The resulting programs, however, tend to still rely on that emulation layer.

For that reason, on Windows, the standard build tool isn't even make at all, but rather MSBuild, which is also an XML-based tool, closer in principle to ant.

By contrast, ant is built in Java, can run everywhere, and contains internal tools, called "tasks", for manipulating files and executing commands in a platform-independent way. It's sufficiently versatile that you can actually have an easier time building a C program in Windows using ant than using make.

And one last minor one:

Even C programs don't use make natively

You may not initially notice this, but C programs generally aren't shipped with a Makefile. They are shipped with a CMakeLists.txt, or a bash configuration script, which generates the actual Makefile. By contrast, the source of a Java program built using ant is shipped with an ant script pre-built. A Makefile is a product of other tools - That's how much make is unsuitable to be a build tool on its own. ant is standalone, and deals with everything you need for your Java build process, without any additional requirements or dependencies.

When you run ant on any platform, it Just Works(tm). You can't get that with make. It's incredibly platform and configuration dependent.

Ant is an XML configuration oriented improvement over Makefiles and Maven is a dependency build tool improvement over Ant. Some projects use all three. I think the JDK projects used to use a mix of makefiles and ant.

One big reason is that both Ant and Maven (and most java targeted SCM, CI and IDE tools) are written in java by/for java developers. This makes it simpler to integrate into your development environment and allows other tools such as the IDE and CI servers to integrate portions of the ant/maven libraries within the build/deployment infrastructure.

Once upon a time I worked on a Java project that used gmake. My recollection is hazy but IIRC we had a hard time dealing with the package directory structure that javac expects. I also remember that building JAR files was a hassle unless you had something trivial.

ApacheAnt isn't anything like Make. Make is about describing dependencies between files, and how to build files. Ant is about dependencies between "tasks", and is really more of a way of gluing build scripts together.

it may helps you AntVsMake

Ant and Maven approach the build dependency graph and the management of it from a more 'modern' view... But as Oscar says, they created their own problems while attempting to address the old problems with make.

I've never used GNU Make for Java projects, but I used to use jmk. Sadly it hasn't been updated since 2002.

It had some Java-specific functionality but was small enough to include in your source tarball without significantly increasing its size.

Nowadays I just assume any Java developer I share code with has Ant installed.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top