• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Run a Maven project without installing Maven

 
Greenhorn
Posts: 1
  • Number of slices to send:
    Optional 'thank-you' note:
Possible odd question here, but do I actually need to install Maven on my device?
I first found out about Maven trying to work on open source (way out of my league), but working on a personal project using Intellij IDEA I was able to create a Maven project, add dependencies, and run it with no issues so far.

Only today when I decided to look at some tutorials did I notice it's actually something you need to install. Both my cmd and IDE terminal don't recognize any mvn commands and I'm unsure of whether or not I am looking at a problem.
 
Saloon Keeper
Posts: 15608
366
  • Number of slices to send:
    Optional 'thank-you' note:
Welcome to CodeRanch!

It depends. Some projects bundle a Maven executable with the source code, so you don't have to separately install Maven. These bundled Maven binaries are called a "Maven wrapper" and you can tell whether the project you're working on has it by looking at the project's root folder and seeing if there's a "mvnw" executable inside of it. If so, you'd use mvnw instead of mvn.

Most projects don't bundle a Maven wrapper though. So yes, it's very likely that you have to install Maven on your system first.
 
Saloon Keeper
Posts: 27851
196
  • Number of slices to send:
    Optional 'thank-you' note:
Maven is a build system. Its primary purpose is to create modules (or "artefacts") such as Web applications, Library JARs, stand-alone executable JARs and the like using a well-defined project directory structure, implied built rules and a request to build one or more goals.

Unlike Ant, which requires you to write your own build rules and define your own directory structure, Maven takes advantage of the "If you've seen one Java project, you've seen them all" approach. Which isn't strictly true, but for the most common types of artefact, it's close enough.

Thus, all files constructed by Maven are placed under a master output directory named /target. Mainline Java source code is under /src/main/java. Unit tests sources are kept separately under /src/test/java so that test files don't get built into production code. Property files and other data files go under /src/main/resources. And so forth.

There is also a master project definition file called the POM (pom.xml) that indicates fine details about the project such as its formal name and version and any dependencies that Maven may need to pull in to do its work.

You can then run goals against the project. For example, "mvn clean" runs the "clean" goal, which simply deletes the /target directory and everything under it. Thanks to the way Maven is organized, I can take a Maven project, run the "clean" goal, ZIP it up and ship it to some faraway land. The recipient can then exactly rebuild everything by unzipping the project and running Maven. The only two things that the recipient needs are compatible versions of Maven (which you can download from https://maven.apache.org and install by unzipping maven and setting the MVN_HOME environment variable (for convenience, add MVN_HOME/bin to your command PATH). And, of course, a compatible version of Java to do the actual compiling and related work. That's all. Just those 2 applications plus your project!

In its basic form, Maven simply takes source and builds an artefact. However, Maven can be extended and goals can be added that will, for example, launch the artefact into a Tomcat webapp server. That's something a lot of people like to do, but it's not actually essential and I prefer not to, myself.

Maven pairs well with IDEs. Generally an IDE will either have a Maven plugin pre-installed as part of the IDE or one can be downloaded and plugged into the IDE. The advantage here is that it makes certain popular Maven functions available from the IDE's menus and toolbars, plus often makes the maven aspects of the project easier to visualize (for example, you can get a dependency graph in an IDE window).
 
Bartender
Posts: 2421
13
  • Number of slices to send:
    Optional 'thank-you' note:
Hi, Tim,
When we use IntelliJ to create a brand new Maven project, there is an archeType option. What is archeType option ? How do we know which option to pick?

There is a documentation here https://maven.apache.org/guides/introduction/introduction-to-archetypes.html
But from your point of view, can you explain archeType and which one topic ?
 
Tim Holloway
Saloon Keeper
Posts: 27851
196
  • Number of slices to send:
    Optional 'thank-you' note:
Archetypes are generic projects. You would normally use one to create the basic layout of a common project, replicate it, and customize the replicas.

In short, you can take any Maven project and catalog it as an archetype.

Maven has quite a few archetypes in its standard repositories, from basic JARs and WARs to stuff like JSF-based webapp projects. Be aware, however, that those archetypes are not given the love that the artefact components are. They're often un-documented and frequently out-of-date.

You can use the archetype feature to create a new Maven project quickly, but you can also just create the project from scratch or steal-and-modify another project.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic
vceplus-200-125    | boson-200-125    | training-cissp    | actualtests-cissp    | techexams-cissp    | gratisexams-300-075    | pearsonitcertification-210-260    | examsboost-210-260    | examsforall-210-260    | dumps4free-210-260    | reddit-210-260    | cisexams-352-001    | itexamfox-352-001    | passguaranteed-352-001    | passeasily-352-001    | freeccnastudyguide-200-120    | gocertify-200-120    | passcerty-200-120    | certifyguide-70-980    | dumpscollection-70-980    | examcollection-70-534    | cbtnuggets-210-065    | examfiles-400-051    | passitdump-400-051    | pearsonitcertification-70-462    | anderseide-70-347    | thomas-70-533    | research-1V0-605    | topix-102-400    | certdepot-EX200    | pearsonit-640-916    | itproguru-70-533    | reddit-100-105    | channel9-70-346    | anderseide-70-346    | theiia-IIA-CIA-PART3    | certificationHP-hp0-s41    | pearsonitcertification-640-916    | anderMicrosoft-70-534    | cathMicrosoft-70-462    | examcollection-cca-500    | techexams-gcih    | mslearn-70-346    | measureup-70-486    | pass4sure-hp0-s41    | iiba-640-916    | itsecurity-sscp    | cbtnuggets-300-320    | blogged-70-486    | pass4sure-IIA-CIA-PART1    | cbtnuggets-100-101    | developerhandbook-70-486    | lpicisco-101    | mylearn-1V0-605    | tomsitpro-cism    | gnosis-101    | channel9Mic-70-534    | ipass-IIA-CIA-PART1    | forcerts-70-417    | tests-sy0-401    | ipasstheciaexam-IIA-CIA-PART3    | mostcisco-300-135    | buildazure-70-533    | cloudera-cca-500    | pdf4cert-2v0-621    | f5cisco-101    | gocertify-1z0-062    | quora-640-916    | micrcosoft-70-480    | brain2pass-70-417    | examcompass-sy0-401    | global-EX200    | iassc-ICGB    | vceplus-300-115    | quizlet-810-403    | cbtnuggets-70-697    | educationOracle-1Z0-434    | channel9-70-534    | officialcerts-400-051    | examsboost-IIA-CIA-PART1    | networktut-300-135    | teststarter-300-206    | pluralsight-70-486    | coding-70-486    | freeccna-100-101    | digitaltut-300-101    | iiba-CBAP    | virtuallymikebrown-640-916    | isaca-cism    | whizlabs-pmp    | techexams-70-980    | ciscopress-300-115    | techtarget-cism    | pearsonitcertification-300-070    | testking-2v0-621    | isacaNew-cism    | simplilearn-pmi-rmp    | simplilearn-pmp    | educationOracle-1z0-809    | education-1z0-809    | teachertube-1Z0-434    | villanovau-CBAP    | quora-300-206    | certifyguide-300-208    | cbtnuggets-100-105    | flydumps-70-417    | gratisexams-1V0-605    | ituonline-1z0-062    | techexams-cas-002    | simplilearn-70-534    | pluralsight-70-697    | theiia-IIA-CIA-PART1    | itexamtips-400-051    | pearsonitcertification-EX200    | pluralsight-70-480    | learn-hp0-s42    | giac-gpen    | mindhub-102-400    | coursesmsu-CBAP    | examsforall-2v0-621    | developerhandbook-70-487    | root-EX200    | coderanch-1z0-809    | getfreedumps-1z0-062    | comptia-cas-002    | quora-1z0-809    | boson-300-135    | killtest-2v0-621    | learncia-IIA-CIA-PART3    | computer-gcih    | universitycloudera-cca-500    | itexamrun-70-410    | certificationHPv2-hp0-s41    | certskills-100-105    | skipitnow-70-417    | gocertify-sy0-401    | prep4sure-70-417    | simplilearn-cisa    |
http://www.pmsas.pr.gov.br/wp-content/    | http://www.pmsas.pr.gov.br/wp-content/    |