Question

In my parent pom file:

<modules>
    <module>../project-snapshot-a</module>
    <module>../project-snapshot-b</module>
    <module>../project-snapshot-c</module>
</modules>

However, in my workspace I have only projects A, B. Other people have in their workspace only projects B, C.

How do I specify in the parent pom that I want to build a child project only if it can be located in the local workspace; otherwise I want it the updated snapshot to be fetched from the remote repository. ???

Was it helpful?

Solution 2

You can have the modules declared in profiles, and each developer can have their own profile. You can set an environment variable to hold the programmer's name, and have the profile activate based on that variable.

OTHER TIPS

Here is a better version of the accepted answer. You can use profiles, of course, but I don't think that every programmer should have a profile. It will result in a large POM, just because you're missing some modules. Instead, you can do this:

http://maven.40175.n5.nabble.com/Ignore-module-if-missing-td84118.html

<profile> 
  <id>module1-build</id> 
  <activation> 
    <file> 
      <exists>module1/pom.xml</exists> 
    </file> 
  </activation> 
  <modules> 
    <module>module1</modules> 
  </modules> 
</profile> 

I think it's cleaner and it speaks for itself.

However, please note that if some modules depends on previous modules, it will not be an easy job.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top