How to get module name from pom in java

I have a requirement where based on the module names I need to do some operations. How to get module name from pom.xml

in java. Class Mine pom.xml

looks like this:

<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>


<modules>
        <module>name1</module>
        <module>name2</module>    
</modules>

      

I saw that we can get artifactId

and the version as shown below from the properties file. Here a module is a list of how to get the names of the modules from the list. Any help would be appreciated.

version=${project.version}
artifactId=${project.artifactId}

      

thank

+3


source to share


1 answer


You could



  • Define names as Maven properties.
  • Define a text file in resources that use these properties.
  • Process this resource file with Maven.
  • Read from the resource file in your bank / war.
+1


source







All Articles