1

my maven pom.xml is quite simple:

<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>org.acb</groupId>
  <artifactId>adfafa</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <dependencies>
<dependency>
  <!-- https://mvnrepository.com/artifact/org.pentaho/pentaho-aggdesigner -->
<groupId>org.pentaho</groupId>
<artifactId>pentaho-aggdesigner</artifactId>
    <version>5.1.5-jhyde</version>
</dependency>

  </dependencies>
</project>

From the pom.xml ,I just want pentaho-aggdesigner which is a parent pom of two modules pentaho-aggdesigner-core.jar and pentaho-aggdesigner-algorithm.jar , my remote repo is :http://repo.spring.io/plugins-release

so , I think ,maven will visit http://repo.spring.io/plugins-release/org/pentaho/pentaho-aggdesigner/5.1.5-jhyde/pentaho-aggdesigner-5.1.5-jhyde.pom to download the parent pom ,then , according to the pom, it will download two sub modules pentaho-aggdesigner-core.jar and pentaho-aggdesigner-algorithm.jar. The content of pentaho-aggdesigner-5.1.5-jhyde.pom is:

<?xml version="1.0" encoding="UTF-8"?>
<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>org.pentaho</groupId>
  <artifactId>pentaho-aggdesigner</artifactId>
  <packaging>pom</packaging>
  <version>5.1.5-jhyde</version>
  <name>Pentaho Aggregate Designer</name>
  <description>Designs aggregate tables for the Mondrian OLAP engine</description>
  <url>http://github.com/pentaho/mondrian</url>
  <inceptionYear>2006</inceptionYear>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <distributionManagement>
    <repository>
      <id>conjars</id>
      <name>Conjars</name>
      <url>http://conjars.org/repo</url>
      <layout>default</layout>
    </repository>
  </distributionManagement>



  <issueManagement />

  <scm>
    <connection>scm:git:git://github.com/julianhyde/pentaho-aggdesigner.git</connection>
    <developerConnection>scm:git:git@github.com:julianhyde/pentaho-aggdesigner.git</developerConnection>
    <url>http://github.com/julianhyde/pentaho-aggdesigner/tree/master</url>
    <tag>pentaho-aggdesigner-5.1.5-jhyde</tag>
  </scm>

  <modules>
    <module>pentaho-aggdesigner-algorithm</module>
    <module>pentaho-aggdesigner-core</module>
  </modules>

  <dependencyManagement>
    <!-- Dependency versions for all sub-modules.
         Sorted by groupId, artifactId. -->
    <dependencies>
      <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.4</version>
      </dependency>
      <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.3</version>
      </dependency>
      <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>1.3.1</version>
      </dependency>
      <dependency>
        <groupId>org.pentaho</groupId>
        <artifactId>pentaho-aggdesigner-algorithm</artifactId>
        <version>5.1.5-jhyde</version>
      </dependency>
      <dependency>
        <groupId>pentaho</groupId>
        <artifactId>mondrian</artifactId>
        <version>3.6.9</version>
      </dependency>
      <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
      </dependency>
      <dependency>
        <groupId>jaxen</groupId>
        <artifactId>jaxen</artifactId>
        <version>1.1-beta-6</version>
      </dependency>

      <!-- Test dependencies. -->
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.4</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.jmock</groupId>
        <artifactId>jmock-junit4</artifactId>
        <version>2.4.0</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.jmock</groupId>
        <artifactId>jmock-legacy</artifactId>
        <version>2.4.0</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.pentaho</groupId>
        <artifactId>pentaho-aggdesigner-algorithm</artifactId>
        <version>5.1.5-jhyde</version>
        <type>test-jar</type>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>2.3.1</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.17</version>
        <scope>test</scope>
      </dependency>
      <dependency>
        <groupId>pentaho</groupId>
        <artifactId>mondrian-data-foodmart-hsqldb</artifactId>
        <version>0.2</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.9.1</version>
        <configuration>
          <links>
            <link>http://docs.oracle.com/javase/7/docs/api/</link>
          </links>
        </configuration>
      </plugin>
    </plugins>
  </reporting>

  <build>
    <defaultGoal>package</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.8</version>
        <executions>
          <execution>
            <id>properties</id>
            <goals>
              <goal>properties</goal>
            </goals>
            <phase>initialize</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.2.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>verify</phase>
            <goals>
              <goal>jar-no-fork</goal>
              <goal>test-jar-no-fork</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.2</version>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>properties-maven-plugin</artifactId>
        <version>1.0-alpha-2</version>
        <executions>
          <execution>
            <phase>initialize</phase>
            <goals>
              <goal>read-project-properties</goal>
            </goals>
            <configuration>
              <files>
                <file>build.properties</file>
              </files>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <!-- If we don't specify gitexe version, git doesn't
             commit during release process. -->
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-provider-gitexe</artifactId>
            <version>1.9.1</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.17</version>
      </plugin>
    </plugins>
  </build>
</project>

you can see , pom indicates clearly that I am not a jar pom but a package pom. But maven still consider it to be a jar pom and tries to download the pentaho-aggdesigner.jar from remote repo, of course , the jar file does not exist and throw this error:

[ERROR] Failed to execute goal on project adfafa: Could not resolve dependencies for project org.acb:adfafa:jar:0.0.1-SNAPSHOT: Could not find artifact org.pentaho:pentaho-aggdesigner:jar:5.1.5-jhyde in springmaven (http://repo.spring.io/plugins-release/) -> [Help 1]
    org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project adfafa: 
Could not resolve dependencies for project org.acb:adfafa:jar:0.0.1-SNAPSHOT: Could not find artifact org.pentaho:pentaho-aggdesigner:jar:5.1.5-jhyde in springmaven (http://repo.spring.io/plugins-release/)
wuchang
  • 3,003
  • 8
  • 42
  • 66

4 Answers4

1

I had the same issue with pentaho-aggdesigner:pom:5.1.5-jhyde, this site solved my problem

https://www.programmersought.com/article/76106349302/

Basically, used aliyun as mirror in maven settings.xml. And for this case, do not use repo.spring.io as mirror as it requires login and will have an "Authentication" error.

ewang
  • 15
  • 3
0

Nah, maven doesn't work like that. See also How to use POMs as a dependency in Maven?

A parent is just a trick to combine configuration for it's child modules. It doesn't automatically introduce transitive dependencies.

So you need to specify the exact jar dependencies. Probably something like:

<dependency>
    <groupId>org.pentaho</groupId>
    <artifactId>pentaho-aggdesigner-algorithm</artifactId>
    <version>5.1.5-jhyde</version>
</dependency>
<dependency>
    <groupId>org.pentaho</groupId>
    <artifactId>pentaho-aggdesigner-core</artifactId>
    <version>5.1.5-jhyde</version>
</dependency>

There are pom's that you can use like this, by including type 'pom' in your dependency:

<dependency>
  <groupId>xxx.yyy</groupId>
  <artifactId>pentaho-all</artifactId>
  <type>pom</type>
  <version>XXXX</version>
</dependency>

In this case, pentaho-all would be a pom with a list of direct dependencies that you then would import as transitive dependencies. But the aggregator pom you found does not have direct dependencies, only modules and dependency management, so that one won't work.

Community
  • 1
  • 1
GeertPt
  • 16,398
  • 2
  • 37
  • 61
  • This is what I meet when I am compiling hive from src code.The compilation failed and I found the configuration.So , it is strange. – wuchang Mar 02 '17 at 01:06
  • You mean , it is obviously a wrong configuration?but what does pom instead of jar indicate? – wuchang Mar 02 '17 at 01:11
  • packaging 'pom' means the module doesn't create a jar/war/ear itself. It's mostly used for parent poms or poms with child modules. – GeertPt Mar 06 '17 at 11:33
0

adding following dependency to pom.xml will help

<!-- https://mvnrepository.com/artifact/org.pentaho/pentaho-aggdesigner-algorithm -->
<dependency>
    <groupId>org.pentaho</groupId>
    <artifactId>pentaho-aggdesigner-algorithm</artifactId>
    <version>5.1.5-jhyde</version>
    <scope>test</scope>
</dependency>
0

Just download the file from any available repo and store in the proper folder e.g.

~/.m2/repository/org/pentaho/pentaho-aggdesigner-algorithm/5.1.5-jhyde/pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar

Vivek
  • 657
  • 11
  • 14