Question

I'm building oracle jdk 1.6 into an rpm using maven and nexus from a zip file distribution of the jdk.

When done, the rpm refuses to install without the following:

[root@build]# rpm -ivh oracle-jdk-1.6.0_26-1.noarch.rpm
error: Failed dependencies:
        libXt.so.6()(64bit) is needed by oracle-jdk-1.6.0_26-1.noarch
        libodbc.so()(64bit) is needed by oracle-jdk-1.6.0_26-1.noarch
        libodbcinst.so()(64bit) is needed by oracle-jdk-1.6.0_26-1.noarch

Fine. I'm guessing maven created this dependency. The jdk in it's native unzipped form works fine.

How can I configure my pom so that maven will not resolve these dependencies?

How would I configure my pom so that yum -y install will install the missing libraries?

I ask both, as I'm not sure which way I will sway.

Edit: my pom:

<?xml version="1.0"?>
<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.oracle</groupId>
  <artifactId>jdk</artifactId>
  <version>1.6.0_26</version>
  <packaging>pom</packaging>
  <properties>
    <unix.user>root</unix.user>
    <rpm.friendly.name>oracle-jdk</rpm.friendly.name>
    <rpm.install.basedir>/usr/java/jdk/1.6.0_26</rpm.install.basedir>
    <sourcefile.unzip.dir>${project.build.directory}/jdk1.6.0_26</sourcefile.unzip.dir>
    <yum.repo.host>localhost</yum.repo.host>
    <yum.repo.path>/apps/httpd/yumrepo</yum.repo.path>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.oracle</groupId>
      <artifactId>jdk</artifactId>
      <version>1.6.0_26</version>
      <type>tar.gz</type>
    </dependency>
  </dependencies>
  <distributionManagement>
    <repository>
      <id>ssh-repository</id>
      <url>scpexe://${yum.repo.host}${yum.repo.path}</url>
    </repository>
  </distributionManagement>
  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.wagon</groupId>
        <artifactId>wagon-ssh-external</artifactId>
        <version>1.0-beta-6</version>
      </extension>
    </extensions>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>rpm-maven-plugin</artifactId>
        <version>2.1-alpha-3</version>
        <executions>
          <execution>
            <id>generate-rpm</id>
            <goals>
              <goal>attached-rpm</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <name>${rpm.friendly.name}</name>
          <copyright>2014, JM</copyright>
          <group>Application/Internet</group>
          <packager>JM</packager>
          <needarch>false</needarch>
          <changelogFile>src/changelog</changelogFile>
          <mappings>
            <mapping>
              <directory>${rpm.install.basedir}</directory>
              <username>${unix.user}</username>
              <groupname>${unix.user}</groupname>
              <sources>
                <source>
                  <location>${sourcefile.unzip.dir}</location>
                </source>
              </sources>
            </mapping>
          </mappings>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.4</version>
        <executions>
          <execution>
            <id>unpack</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <repository>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <id>thirdparty</id>
      <url>http://myrepo.com:8081/nexus/content/repositories/thirdparty</url>
    </repository>
  </repositories>
</project>
Was it helpful?

Solution

Basically i think its not a good idea to include other binaries (like java) in your package
i'd rather have dependency on them.

But sometimes you have to, for example customer already have Java on his machine but you want to run your own java version and thus provide it with your package.

To do that you can simply tell the maven plugin not to automatically add requires to those packages.

like this

<configuration>  
     ......
     <autoRequires>false</autoRequires>
</configuration>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top