{"id":236,"date":"2010-04-14T11:01:31","date_gmt":"2010-04-14T11:01:31","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/2010\/04\/14\/properties-in-maven\/"},"modified":"2021-11-20T05:15:18","modified_gmt":"2021-11-20T05:15:18","slug":"properties-in-maven","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/properties-in-maven\/","title":{"rendered":"Properties in Maven &#8211; List of Maven Properties"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4272\" src=\"http:\/\/www.scmgalaxy.com\/tutorials\/wp-content\/uploads\/2010\/04\/properties-in-maven.png\" alt=\"properties-in-maven\" width=\"600\" height=\"400\" srcset=\"https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2010\/04\/properties-in-maven.png 600w, https:\/\/www.devopsschool.com\/blog\/wp-content\/uploads\/2010\/04\/properties-in-maven-300x200.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<p><b>Intro<\/b><br>\nIt is a collection of things found in the offcial maven documentation and postings to the maven user mailing list.<br>\n<b>Build in properties<\/b><\/p>\n<ul type=\"disc\">\n<li>${basedir} represents the directory containing pom.xml<\/li>\n<li>${version} equivalent to ${project.version} or ${pom.version}<\/li>\n<\/ul>\n<p><b>Pom\/Project properties<\/b><br>\nAll elements in the pom.xml, can be referenced with the project. prefix or using pom. as prefix. This list is just an example of some commonly used elements.<\/p>\n<ul type=\"disc\">\n<li>${project.build.directory} results in the path to your &#8220;target&#8221; dir, this is the same as ${pom.project.build.directory}<\/li>\n<li>${project.build.outputDirectory} results in the path to your &#8220;target\/classes&#8221; dir<\/li>\n<li>${project.name} or ${pom.name} refers to the name of the project.<\/li>\n<li>${project.version} or ${pom.version} refers to the version of the project.<\/li>\n<li>${project.build.finalName} refers to the final name of the file created when the built project is packaged<\/li>\n<\/ul>\n<p><b>Local user settings<\/b><br>\nSimilarly, values in the user&#8217;s settings.xml can be referenced using property names with settings. prefix.<\/p>\n<ul type=\"disc\">\n<li>${settings.localRepository} refers to the path of the user&#8217;s local repository.<\/li>\n<li>${maven.repo.local} also works for backward compatibility with maven1 ??<\/li>\n<\/ul>\n<p><b>Environment variables<\/b><br>\nEnvironment variables can be referenced using the env prefix<\/p>\n<ul type=\"disc\">\n<li>${env.M2_HOME} returns the Maven2 installation path.<\/li>\n<li>${java.home} specifies the path to the current JRE_HOME environment use with relative paths to get for example:<br>\n${java.home}..\/bin\/java.exe<\/li>\n<\/ul>\n<p><b>Java system properties<\/b><br>\nAll Java System Properties defined by the JVM.<br>\n<b>Custom properties in the POM<\/b><br>\nUser defined properties in the pom.xml.<br>\n&#8230;<br>\nhello<br>\n&#8230;<\/p>\n<ul type=\"disc\">\n<li>${my.filter.value} will result in hello if you inserted the above XML fragment in your pom.xml<\/li>\n<\/ul>\n<p><b>Parent Project variables<\/b><br>\nHow can parent project variables be accessed?<br>\nYou can use the prefix: ${project.parent}.<br>\nA good way to determine possible variables is to have a look directly at the API. I&#8217;m currently using Maven 2.2.1, and to access the Parent you can use ${project.parent}. This will return an <a href=\"http:\/\/maven.apache.org\/ref\/2.0.4\/maven-project\/apidocs\/org\/apache\/maven\/project\/MavenProject.html\" target=\"_blank\" rel=\"noopener\">org.apache.maven.project.MavenProject<\/a> instance.<br>\nTo access the parent version: ${parent.version}.<br>\n<b>Reflection Properties<\/b><br>\nThe pattern ${someX.someY.someZ} can simply sometimes mean getSomeX().getSomeY().getSomeZ(). Thus, properties such as ${project.build.directory} is translated to getProject().getBuild().getDirectory().<br>\n<b>List of Maven Properties<\/b><\/p>\n<p>project (from [1])<br>\no project.distributionManagementArtifactRepository<br>\no project.artifact<br>\no project.parent<br>\no project.file<br>\no project.artifacts<br>\no project.parentArtifact<br>\no project.pluginArtifacts<br>\no project.remoteArtifactRepositories<br>\no project.pluginArtifactRepositories<br>\no project.attachedArtifact<br>\n* settings (from [2])<br>\no settings.offilne<br>\no settings.interactive<br>\n* rootless (from [3])<br>\no localRepository<br>\no reactorProjects<br>\n* java properties (from [4])<br>\no java.version<br>\no java.vendor<br>\no java.vendor.url<br>\no java.home<br>\no java.vm.specification.version<br>\no java.vm.specification.vendor<br>\no java.vm.specification.name<br>\no java.vm.version<br>\no java.vm.vendor<br>\no java.vm.name<br>\no java.specification.version<br>\no java.specification.vendor<br>\no java.specification.name<br>\no java.class.version<br>\no java.class.path<br>\no java.library.path<br>\no java.io.tmpdir<br>\no java.compiler<br>\no java.ext.dirs<br>\no os.name<br>\no os.arch<br>\no os.version<br>\no file.separator<br>\no path.separator<br>\no line.separator<br>\no user.name<br>\no user.home<br>\no user.dir<\/p>\n<p>&nbsp;<\/p>\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_30304\"><figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube epyt-figure\"><div class=\"wp-block-embed__wrapper\"><iframe loading=\"lazy\"  id=\"_ytid_78255\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_30304\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><\/div><\/figure><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Intro It is a collection of things found in the offcial maven documentation and postings to the maven user mailing list. Build in properties ${basedir} represents the directory containing pom.xml ${version} equivalent to ${project.version} or ${pom.version} Pom\/Project properties All elements in the pom.xml, can be referenced with the project. prefix or using pom. as prefix&#8230;.<\/p>\n","protected":false},"author":1,"featured_media":4272,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[29],"tags":[3880,161,3878,3879,3871,3882,3873,3875,3881,3876,3874,3877,1073,3872],"class_list":["post-236","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-maven","tag-list-of-maven-properties","tag-maven","tag-maven-build-in-properties","tag-maven-pom-project-properties","tag-maven-properties","tag-maven-properties-cheatsheet","tag-maven-properties-guide","tag-maven-properties-instructions","tag-maven-properties-list","tag-maven-properties-references","tag-maven-properties-tutorials","tag-pom","tag-properties","tag-properties-in-maven"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/236","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=236"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/236\/revisions"}],"predecessor-version":[{"id":25872,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/236\/revisions\/25872"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/4272"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=236"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=236"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=236"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}