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. ???

有帮助吗?

解决方案 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.

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top