Accessing a file specified by parameter from a submodule

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing a file specified by parameter from a submodule

Russell Gold-3
In my project https://github.com/oracle/weblogic-monitoring-exporter/, one option is to specify a file path on the command line, such as:

mvn clean install -Dconfiguration=samples/configuration/servlets.yml

and this works whether the path is actually absolute or relative, since the invocation is made from the top module. Now I need something a bit more complex, and have to invoke it from a submodule (not yet pushed to GitHub). But that gets invoked from the submodule’s directory, which means that a relative path will be wrong. Is there a way to copy a file using the current directory of the parent (pom) project?
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Accessing a file specified by parameter from a submodule

Martin Kanters
Hi Russell,

The variable where you are looking for is generally called `
multiModuleProjectDirectory` in the codebase of Maven. Unfortunately I'm
not sure if you can use this in a system property value.

I am not sure if this fits your use-case, but an alternative way of only
invoking a submodule while staying in the root module is by using the -pl
or -f option:
- mvn clean install -Dconfiguration=samples/configuration/servlets.yml -pl
:<submodule-artifactid>
- mvn clean install -Dconfiguration=samples/configuration/servlets.yml -f
<submodule-artifactid>/pom.xml

HTH,
Martin

Op di 4 aug. 2020 om 21:48 schreef Russell Gold <[hidden email]>:

> In my project https://github.com/oracle/weblogic-monitoring-exporter/,
> one option is to specify a file path on the command line, such as:
>
> mvn clean install -Dconfiguration=samples/configuration/servlets.yml
>
> and this works whether the path is actually absolute or relative, since
> the invocation is made from the top module. Now I need something a bit more
> complex, and have to invoke it from a submodule (not yet pushed to GitHub).
> But that gets invoked from the submodule’s directory, which means that a
> relative path will be wrong. Is there a way to copy a file using the
> current directory of the parent (pom) project?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>