{"id":1391,"date":"2016-08-14T16:31:07","date_gmt":"2016-08-14T14:31:07","guid":{"rendered":"http:\/\/blog.rabahi.net\/?page_id=1391"},"modified":"2016-08-14T16:33:57","modified_gmt":"2016-08-14T14:33:57","slug":"maven-predefined-properties","status":"publish","type":"page","link":"https:\/\/blog.rabahi.net\/?page_id=1391","title":{"rendered":"Maven predefined properties"},"content":{"rendered":"<p>By default maven has some predefined properties. They are all defined in :<br \/>\n${MAVEN_HOME}\/lib\/maven-model-builder.jar!org\/apache\/maven\/model\/pom-4.0.0.xml<\/p>\n<h3>Example pom.xml<\/h3>\n<pre lang=\"java\">\r\n<project>\r\n      <modelVersion>4.0.0<\/modelVersion>\r\n      <groupId>com.mycompany.myapp<\/groupId>\r\n      <artifactId>my-module<\/artifactId>\r\n      <name>my-module name<\/name>\r\n      <version>1.0.0-SNAPSHOT<\/version>\r\n\r\n\t  <build>\r\n\t\t<directory>${project.basedir}\/target<\/directory>\r\n\t\t<outputDirectory>${project.build.directory}\/classes<\/outputDirectory>\r\n\t\t<finalName>${project.artifactId}-${project.version}<\/finalName>\r\n\t\t<testOutputDirectory>${project.build.directory}\/test-classes<\/testOutputDirectory>\r\n\t\t<sourceDirectory>${project.basedir}\/src\/main\/java<\/sourceDirectory>\r\n\t\t<scriptSourceDirectory>${project.basedir}\/src\/main\/scripts<\/scriptSourceDirectory>\r\n\t\t<testSourceDirectory>${project.basedir}\/src\/test\/java<\/testSourceDirectory>\r\n\t\t<resources>\r\n\t\t  <resource>\r\n\t\t\t<directory>${project.basedir}\/src\/main\/resources<\/directory>\r\n\t\t  <\/resource>\r\n\t\t<\/resources>\r\n\t\t<testResources>\r\n\t\t  <testResource>\r\n\t\t\t<directory>${project.basedir}\/src\/test\/resources<\/directory>\r\n\t\t  <\/testResource>\r\n\t\t<\/testResources>\r\n\t<\/build>\r\n\r\n\r\n<\/project>\r\n\r\n<\/pre>\n<table class=\"table table-bordered table-condensed\">\n<caption>Project model variables<\/caption>\n<thead>\n<tr>\n<th>Property<\/th>\n<th>Value<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>${project.basedir}<\/td>\n<td>directory (full path) that contains the pom.xml<\/td>\n<\/tr>\n<tr>\n<td>${project.groupId}<\/td>\n<td>the project groupId (i.e. com.mycompany.myapp)<\/td>\n<\/tr>\n<tr>\n<td>${project.artifactId}<\/td>\n<td>the project artifactId (i.e. my-module)<\/td>\n<\/tr>\n<tr>\n<td>${project.name}<\/td>\n<td>the project name (i.e. my-module name)<\/td>\n<\/tr>\n<tr>\n<td>${project.version}<\/td>\n<td>the project version (i.e. 1.0.0-SNAPSHOT)<\/td>\n<\/tr>\n<tr>\n<td>${project.build.directory}<\/td>\n<td>${project.basedir}\/target<\/td>\n<\/tr>\n<tr>\n<td>${project.build.outputDirectory}<\/td>\n<td>${project.build.directory}\/classes<\/td>\n<\/tr>\n<tr>\n<td>${project.build.finalName}<\/td>\n<td>${project.artifactId}-${project.version}<\/td>\n<\/tr>\n<tr>\n<td>${project.build.testOutputDirectory}<\/td>\n<td>${project.build.directory}\/test-classes<\/td>\n<\/tr>\n<tr>\n<td>${project.build.sourceDirectory}<\/td>\n<td>${project.basedir}\/src\/main\/java<\/td>\n<\/tr>\n<tr>\n<td>${project.build.scriptSourceDirectory}<\/td>\n<td>${project.basedir}\/src\/main\/scripts<\/td>\n<\/tr>\n<tr>\n<td>${project.build.testSourceDirectory}<\/td>\n<td>${project.basedir}\/src\/test\/java<\/td>\n<\/tr>\n<tr>\n<td>${project.build.resources[0].directory}<\/td>\n<td>${project.basedir}\/src\/main\/resources<\/td>\n<\/tr>\n<tr>\n<td>${project.build.testResources[0].directory}<\/td>\n<td>${project.basedir}\/src\/test\/resources<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>By default maven has some predefined properties. They are all defined in : ${MAVEN_HOME}\/lib\/maven-model-builder.jar!org\/apache\/maven\/model\/pom-4.0.0.xml Example pom.xml 4.0.0 com.mycompany.myapp my-module my-module name 1.0.0-SNAPSHOT ${project.basedir}\/target ${project.build.directory}\/classes ${project.artifactId}-${project.version} ${project.build.directory}\/test-classes ${project.basedir}\/src\/main\/java ${project.basedir}\/src\/main\/scripts ${project.basedir}\/src\/test\/java ${project.basedir}\/src\/main\/resources ${project.basedir}\/src\/test\/resources Project model variables Property Value ${project.basedir} directory (full path) that contains the pom.xml ${project.groupId} the project groupId (i.e. com.mycompany.myapp) ${project.artifactId} the project artifactId (i.e. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":884,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1391","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1391"}],"version-history":[{"count":11,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1391\/revisions"}],"predecessor-version":[{"id":1402,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/1391\/revisions\/1402"}],"up":[{"embeddable":true,"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=\/wp\/v2\/pages\/884"}],"wp:attachment":[{"href":"https:\/\/blog.rabahi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}