Question

I am using Eclipse Indigo with m2e (which connects to an external binary of Maven 3.0.3).

Right now, the intended structure of my application is as follows:

Company-parent
--Project-parent
----Module1
----Module2
----ModuleN

I set up my poms such that Company-parent is the project of Project-parent, and Project-parent is the parent of all of the modules. The company-parent and the project-parent seem to be ok. Both are of packaging type POM.

The third level is where I start to encounter problems. I get a variety of maven errors, and all kinds of weird behavior, even with the simplest of module projects defined.

Company parent:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.scoresecret</groupId>
  <artifactId>scs-global-parent</artifactId>
  <version>1</version>
  <packaging>pom</packaging>

</project>

Project parent:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <artifactId>scs-global-parent</artifactId>
    <groupId>com.scoresecret</groupId>
    <version>1</version>
  </parent>

  <artifactId>scs-model-parent</artifactId>
  <groupId>com.scoresecret.model</groupId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <modules>
    <module>scs-model-core</module>
  </modules>

</project>

Module pom:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <artifactId>scs-model-parent</artifactId>
    <groupId>com.scoresecret.model</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>

  <artifactId>scs-model-core</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>jar</packaging>

I can't do "Maven -> Update Project Configuration", because when I do, I get this error:

Failure to find org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 in https://my.archiva.location/archiva/repository/internal was cached in the local repository, resolution will not be reattempted until the update interval of scs.internal has elapsed or updates are forced pom.xml /scs-model-core line 1  Maven Configuration Problem

Some other errors I'm receiving:

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.4.3 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.4.3 pom.xml /scs-model-core line 1  Maven Build Problem

Also receiving an error about m2e ignoring one of my plugin goals (from the company level pom) within the module. Am I missing something obvious here? Help!

Thanks :)

Was it helpful?

Solution 4

It turns out, that my local repo contained files which ended with the extention ".lastUpdated" ... this was because I was having problems with authentication when I tried encrypting my maven passwords, so it wasn't downloading the dependencies. I deleted those files and simply ran "Maven > Update Dependencies" and it worked no problem, downloading the missing resources from my artifact repository.

OTHER TIPS

you shouldn't have the artifacts located like you described in a directory structure.

+-- Company-parent (pom.xml)
      +-- Project-parent (pom.xml)
            +----Module1 (pom.xml)
            +----Module2 (pom.xml)
            +----ModuleN (pom.xml)

To make a real good use of you company-parent (pom.xml) it should be helt into a separated area in version control and released separately in your repository manager (nexus, artifactory, archiva...). This will result in the following structure:

+-- Company-parent (pom.xml) (Separate Project)

The company-parent should be released as often as needed via the release-plugin. Lets assume we have released version 1.0 of the company-parent. The reason to have it separated is, cause the company-parent is used by many projects and not only by a single project.

and the real projects should be put into a separate folder (also in version control):

+-- Project-parent (pom.xml)
     +----Module1 (pom.xml)
     +----Module2 (pom.xml)
     +----ModuleN (pom.xml)

So to use the company-parent in your project the project-parent has to look like:

<project....>
 <modelVersion>4.0...</modelVersion>

<parent>
  <artifactId>company-parent</artifactId>
  <groupId>com.company.base</groupId>
  <version>1.0</version>
</parent>

<packaging>pom</packaging>

<groupId>com.company.project1</groupId>
<artifactId>project-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
...
<dependencyManagement>
 <!-- Project specific dependencies -->
</dependencyManagement>
<build>
  <pluginManagement>
    <plugins>
      <!-- Project specific plugins. Better use them of the company pom -->
    </plugins>
  </pluginManagement>
</build>
<modules>
  <module>module1</module>
  <module>module2</module>
  <module>moduleN</module>
</modules>
..

Now let us take a look into a module which should look like this:

<project....>
 <modelVersion>4.0...</modelVersion>

<parent>
  <artifactId>project-parent</artifactId>
  <groupId>com.company.project1</groupId>
  <version>1.0.0-SNAPSHOT</version>
</parent>

<packaging>jar</packaging>

<artifactId>module1</artifactId>

<dependencies>...</dependencies>
<build>..</build>

You should reference the parent pom with explicit path:

<parent>
  <artifactId>scs-model-parent</artifactId>
  <groupId>com.scoresecret.model</groupId>
  <version>1.0-SNAPSHOT</version>
  <relativePath>../pom.xml</relateivePath>
</parent>

Otherwise, you need to reinstall the parent pom into the repository every time you change it.

Sounds like maven isn't able to download a plugin (org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3) from the repository https://my.archiva.location/archiva/repository/internal

Failure to find org.apache.maven.plugins:maven-resources-plugin:pom:2.4.3 in https://my.archiva.location/archiva/repository/internal was cached in the local repository, resolution will not be reattempted until the update interval of scs.internal has elapsed or updates are forced pom.xml /scs-model-core line 1 Maven Configuration Problem

If you browse to this URL in a browser, does it exist? I see it's using https - do you need a client cert or some form of basic auth credentials to access this url?

What are your current settings in your .m2/settings.xml show for repositories? Are you behind a company firewall or not connected to the internet which is forcing you to connect to a non-standard maven central repository?

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