<pluginRepository> in parent pom is ignored when parent pom is accessed through repository

I have company maven repository. I have company super pom.xml with sections <repository> and <pluginRepository> pointing to company repo. Company super pom is separated artifact.

I develop my maven project. Parent pom is company super pom. In order to pass build on clean environment I need to define again <repository> in my project home because Maven must know where parent pom can be found (see Catch-22)

I'm not happy that I have define to company repository again in my project but I accepted it.

In my project I use company plugin. The problem is that Maven cannot find company plugin. It is strange because maven finds super pom with <pluginRepository> but does not use the plugin repository to find the plugin! So I have to define again <pluginRepository>

Super pom:

<repositories>
    <repository>
        <id>company-repo</id>
        <url>http://mycompany.com/repo</url>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>company-repo</id>
        <url>http://mycompany.com/repo</url>
    </pluginRepository>
</pluginRepositories>

My project pom:

<!-- required to find company super pom - unhappy but accepted-->
<repositories>
    <repository>
        <id>company-repo</id>
        <url>http://mycompany.com/repo</url>
    </repository>
</repositories>
<!-- required to find company plugin - unhappy and hard to accept-->
<pluginRepositories>
    <pluginRepository>
        <id>company-repo</id>
        <url>http://mycompany.com/repo</url>
    </pluginRepository>
</pluginRepositories>

Question: Is is possible to avoid repeat plugin repository configuration in each Maven project? Maybe I should change my desing/configuration/whatever?

What interesting, <pluginRepositories> is not required if super pom is accessed through relative path instead of through repository.

Maven 3.3.3

UPDATE:

If I remove <pluginRepositories> from my project pom then effective-pom does NOT show company-repo as plugin repository. I wish.

Answers


Simplest would be to setup your settings.xml file like this:

<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://localhost:8081/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>nexus</id>
      <!--Enable snapshots for the built in central repo to direct -->
      <!--all requests to nexus via the mirror -->
      <repositories>
        <repository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </repository>
      </repositories>
     <pluginRepositories>
        <pluginRepository>
          <id>central</id>
          <url>http://central</url>
          <releases><enabled>true</enabled></releases>
          <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <activeProfiles>
    <!--make the profile active all the time -->
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

And using a repository manager makes life easier...Apart from that you can of course use a single pom which could be made. But using a parent can't be changed for the developer and you can't change on a CI solution (like Jenkins) to configure their the appropriate settings.xml


Need Your Help

Folder within Program Menu Folder for WiX 3

wix wix3

Following some example code on the net, I got my first WiX installer to work. However, it placed my program menu shortcut directly on Program Menus. I really want to create a folder, Sample, in P...

iOS 9.2 missing Profile section from General Settings

ios iphone ipad

I was trying to activate a developer app in iOS 9.2 and the app was not trusted due to security settings. I tried to go into the Profile area under General Settings, but it wasn't there. What giv...