2014-02-10 149 views
1

我使用maven和nexus從jdk的zip文件分發構建oracle jdk 1.6到rpm中。構建一個包含JDK依賴關係解析的RPM

完成後,轉速拒絕安裝不執行下列操作:

[[email protected]]# 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 

精細。我猜maven創建了這種依賴關係。它的原生解壓縮表單中的jdk可以正常工作。

如何配置我的pom,以便maven不會解決這些依賴關係?

我該如何配置我的pom,以便yum -y install會安裝缺少的庫?

我問這兩個,因爲我不知道我會搖擺。

編輯:我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> 
+0

你能告訴到目前爲止,你做了什麼? – khmarbaise

+0

我已將pom添加到問題 – Jepper

+0

我在生成資源階段在內部嘗試了 **/db/*。沒有快樂。 – Jepper

回答

3

基本上我認爲它不是一個好主意,包括其他二進制文件(如Java)在你的包
我寧願對他們的依賴。

但是有時你必須例如客戶已經在他的機器上安裝了Java,但是你想運行你自己的Java版本並且因此提供給你的包。

要做到這一點,你可以簡單地告訴maven插件不要自動添加對這些包的需求。

這樣

<configuration> 
    ...... 
    <autoRequires>false</autoRequires> 
</configuration>