문제

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