Saturday, June 29, 2019

Maven Project creation


 create a project using maven:

--------------------------
mvn archetype:generate -B -DgroupId=com.teamtreehouse -DartifacId=file-spy

archetype -- template used
-B -- batch mode, tells to not ask questions while running.
-D -- system properties we pass

tree command will list the dir structure.

mkdir src/main/resources src/test/resources





















POM.XML



search.maven.org --> search apache tika(for examining file metadata like filetypes used)
select tike-core, there you can see the project coordinates mentioned.








-SNAPSHOT means, work in progress.
You will get the 3rd party project ddeendency details by clicking on above version section and fetch the details from there.
After adding the dependency, need to click refresh on the intelliJ maven projects section.



Above, site for html documentation of the project.
Within lifecycles, we have phases.



From project root folder.
Ø  mvn compile
the build section in the pom.xml will be generated automatically by IDE, where we can see source and target version numbers.





















Ø  mvn package
will create the jar file.
With naming, artifactid-version.jar
~/.m2 where local repos will be there.
To add this jar to the local repo, mvn install
tree -P 'file-spy*jar' –prune

You can add this jar now as a dependency to other maven project.








Lifecycle contains tasks,tasks contains goals.
These goals are provided by plugins.
Like exec plugin.



Create a wrapper in maven, will generate mvn.cmd and linux shell scripts so team members can fetch modules directly without maven installation.



No comments:

Post a Comment