makefile - Which version of Make to use for Java? -
i have make (windows sdk), nmake (visual studio) , make (codegear)
which version of make use compile java apps? "make" from? downloaded jdk , there no make. searched around compile java makefile.
what use, if have makefile , *.java files?
java projects rarely use make , makefiles. in fact, i've ever seen used once in practice , 13 years ago, predating java build tools. instead java projects use 1 of 2 leading build tools.
based on question i'm going assume have no particular reason use make (in you're not trying compile existing project has makefile).
ant
ant xml-based scripting build tool bears little (but not lot) similarity makefile in concept. ant build script define number of tasks. tasks depend on other tasks. tasks can include compiling java source files, building jars , really.
ant flexible end writing bunch of boilerplate on , on (between projects). no 2 moderately complex ant projects same , dependencies can become huge problem. "dependencies" i'm not talking source dependencies dependencies on third-party libraries. ant has tool called ivy managing dependencies.
maven
maven other common build tool. maven differs ant in maven defines project types (archetypes) such web application. when choose 1 (or more) archetype project, mandates directory structure quite deep. example:
project-name +- src/ +- main/ +- java/ +- com/example/project-name/ +- java source files +- test/ +- tends mirror above +- target/ +- classes/ +- com/example/project-name/ +- java class files +- test-classes/ +- tends mirror above ...etc...
now people don't this, in part because people don't being told (imho) things legacy reasons , other factors. consider thing because once you're familiar maven web application project, can go other maven web application project , find way around.
maven give lots of standard commands run, such compile, test, install, etc.
maven useful dependencies on third-party libraries. declare these in maven project file , retrieved repositories on internet (and cached locally unless set otherwise).
so advice use 1 of these two. may used makefiles if come c/c++ background isn't java way. said, may have reason use make java such existing project new project should absolutely use ant or maven instead, in opinion.
Comments
Post a Comment