Monday, November 15, 2021

[SOLVED] how do reference a source directory from and artifiact declared as a dependency

Issue

I have an assembly module that builds the directory structure I need under the target directory. All folders are there as expected. These dirs include config, docs, lib etc. Some include jars while the others contain stadard shell scripts and files etc.

Now I want to reference this artifact, lets say its called rpm-prep in another pom module, that will use this target directory structure to pull out the bits I need to build the rpm using the maven rpm plugin. I did this as I have a multi module project and I couldnt reference the sub dirs in each module without specifying the full path...

So I want to be able to reference the following as follows:

"rpm-prep" artifact declared as a dependency in "rpm-module":
  <dependency>
      <groupId>com.blah.blah</groupId>
      <artifactId>rpm-prep</artifactId>      //contains dir struct I need to extract
      <version>${project.version}</version>
  </dependency>

Now in the "rpm-module" pom I want to be able to reference the conf sub directory under the target directory. How do I do thishaving declared the dependency above? e.g.

 <mapping>
      ....
       .......
       <dependency>
          <includes>
            <include>??? dependency-target-conf directory from above dependency?????
            </include>
          </includes>
        </dependency>
 </mapping>

I know I can reference jars, zips etc but I need the dir in this case and all the contents etc.


Solution

How about unpacking the assembly using maven dependency plugin's dependency:unpack and then using the relevant folders/contents from there?



Answered By - Raghuram