0

My multi module project is made of public (open source) and private (undisclosed) modules. I need to create a master-all pom file referencing master-public and master-private, so that some plugins & commands are aware of all projects (e.g. cobertura). master-all has thus to be private as it references master-private.

The problem is that master-public should reference its parent master-all which is private, so users of public modules only won't be able to build them:

<groupId>group</groupId>
<artifactId>master-public</artifactId>
<parent>
    <groupId>group</groupId>
    <artifactId>master-all</artifactId>
    <version>1.0-SNAPSHOT</version>
</parent>

Nesting master-public in master-private could be a solution for maven, but will be a mess for git.

Is there a clean way to do this?

Martin Pernollet
  • 2,285
  • 1
  • 28
  • 39

1 Answers1

2

You can have your master-private reference your master-public. But in my experience, it is best to keep them completely separate. Eventually, the master-public will be tuned more to open source, possibly deploying to Maven Central, while the master-private will deploy to your internal repository and possible have some special settings that only make sense in your enterprise environment. Copy whatever you absolutely need from your master-private to your master-public and disconnect the two.

rec
  • 10,340
  • 3
  • 29
  • 43
  • I agree, but how would you arrange to have plugins (e.g. cobertura) to work with public+private. For example if I want the tests of the public API to remain in the private part, I need to start cobertura from a pom file able to access them both so that the API are instrumented before starting the test, which is not possible if I have a simple dependency private->public. – Martin Pernollet Aug 17 '13 at 17:03
  • You should seriously consider making the tests of your public product public as well. If you absolutely cannot do that, you may consider deploying the instrumented binaries to a Maven repository and use them when running your private tests. – rec Aug 17 '13 at 20:54
  • It's actually not answering the question, but encourage to work differently so I validate the answer :) Thanks – Martin Pernollet Aug 18 '13 at 08:39