简体   繁体   English

如何分配工件/分类器罐:抱怨缺少pom文件

[英]How to Distributable Artifact/Classifier Jars : Complaining of missing pom file

Project background; 项目背景; large amounts of JNI projects for my group. 我小组中的大量JNI项目。 Looking to simplify the build/release strategies as the JNI projects themselves have dependency chains. 由于JNI项目本身具有依赖关系链,因此希望简化构建/发布策略。

Used a model similar to here: http://mail-archives.apache.org/mod_mbox/maven-users/200706.mbox/%3C56761.84.233.182.145.1181035390.squirrel@www.sharp.fm%3E as a prototype that works well. 使用类似于此处的模型: http : //mail-archives.apache.org/mod_mbox/maven-users/200706.mbox/%3C56761.84.233.182.145.1181035390.squirrel@www.sharp.fm%3E作为原型效果很好。 A distribution module adds the appropriate jars and the classifier is used. 分发模块添加适当的罐子,并使用分类器。 Example final jar would be CiscoJ-dist-unix-amd64.jar. 最终jar的示例是CiscoJ-dist-unix-amd64.jar。

Problem I'm hitting appears that install creates the project pom but attempting to use the classifier jar in a project, its is looking for the pom file matching the classifier; 我遇到的问题是安装程序创建了项目pom,但是尝试在项目中使用分类器jar,它正在寻找与分类器匹配的pom文件; thus from above its looking for J-dist-unix-amd64.pom. 因此,从其上方寻找J-dist-unix-amd64.pom。 The only pom that exists is of course the project pom J-dist.pom. 存在的唯一pom当然是项目pom J-dist.pom。

[WARNING] [警告]

The POM for com.cisco.ciscossl:CiscoJ-dist:jar:unix-amd64:1.00 is missing, no dependency information available [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=1, ConflictMarker.markTime=0, ConflictMarker.nodeCount=4, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=1, ConflictIdSorter.conflictIdCount=3, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=2, ConflictResolver.conflictItemCount=3, DefaultDependencyCollector.collectTime=290, DefaultDependencyCollector.transformTime=6} 缺少com.cisco.ciscossl:CiscoJ-dist:jar:unix-amd64:1.00的POM,没有可用的依赖项信息[DEBUG]依赖项收集状态:{ConflictMarker.analyzeTime = 1,ConflictMarker.markTime = 0,ConflictMarker.nodeCount = 4,ConflictIdSorter.graphTime = 0,ConflictIdSorter.topsortTime = 1,ConflictIdSorter.conflictIdCount = 3,ConflictIdSorter.conflictIdCycleCount = 0,ConflictResolver.totalTime = 2,ConflictResolver.conflictItemCount = 3,DefaultDependencyCollector.collectTime = 290,DefaultDependencyCollector。 }

In project attempting to build with architecture dependent information. 在项目中尝试使用与体系结构相关的信息进行构建。

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
    </dependency>    
    <dependency>
      <groupId>com.cisco.ciscossl</groupId>
      <artifactId>CiscoJ-dist</artifactId>
      <classifier>${os.family}-${os.arch}</classifier>
      <version>1.00</version>
    </dependency>
</dependencies>

According to this; 根据这个; http://maven.40175.n5.nabble.com/pom-does-not-get-installed-if-classifier-used-td120388.html ; http://maven.40175.n5.nabble.com/pom-does-not-get-installed-if-classifier-used-td120388.html it should be fixed with my version of maven (3.1.1). 应该用我的Maven版本(3.1.1)修复。

Pom File of Project 项目的Pom文件

<project>
  <modelVersion>4.0.0</modelVersion> 
  <groupId>com.cisco.ciscossl.CiscoJ</groupId>
  <artifactId>CiscoJ-dist</artifactId>
  <version>1.00</version>
  <packaging>jar</packaging>

  <parent>
    <groupId>com.cisco.ciscossl</groupId>
    <artifactId>CiscoJ</artifactId>
    <version>1.00</version>
  </parent>

  <dependencies>
    <dependency>
      <groupId>${pom.groupId}</groupId>
      <artifactId>CiscoJUtils</artifactId>
      <version>1.00</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>${pom.groupId}</groupId>
      <artifactId>CiscoJCE</artifactId>
      <version>1.00</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>${pom.groupId}</groupId>
      <artifactId>CiscoJSafeC</artifactId>
      <version>1.00</version>
      <classifier>${os.family}-${os.arch}</classifier>      
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>${pom.groupId}</groupId>
      <artifactId>CiscoJCEJNI</artifactId>
      <version>1.00</version>
      <classifier>${os.family}-${os.arch}</classifier>      
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>1.7.2</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.2</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
      <execution>
        <id>package-all</id>
        <phase>package</phase>
        <goals>
          <goal>single</goal>
        </goals>
        <configuration>
          <descriptors>
        <descriptor>src/main/assembly/dist-jar.xml</descriptor>
          </descriptors>
        </configuration>
      </execution>
    </executions>
      </plugin>
    </plugins> 
  </build> 
</project>

Assembler: 汇编器:

<assembly
  xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
  <id>${os.family}-${os.arch}</id>
  <formats>
    <format>jar</format>
  </formats>

  <includeBaseDirectory>false</includeBaseDirectory>

  <dependencySets>
    <dependencySet>
      <excludes>
    <exclude>org.slf4j:slf4j-simple</exclude>
    <exclude>org.slf4j:slf4j-api</exclude>
    <exclude>junit:junit</exclude>
      </excludes>
      <unpack>true</unpack>
      <useTransitiveDependencies>false</useTransitiveDependencies>
    </dependencySet>
  </dependencySets>
</assembly>

I messed a bit with the maven-install-plugin install-file for the artifact, not much success yet though. 我对工件的maven-install-plugin安装文件感到有些困惑,但是还没有成功。

I think I determined that I had an invalid artifact in the file attempting to use the artifact. 我认为我确定我的文件中有一个无效的工件,试图使用该工件。 I believe, and looks like it worked, that should be accessing it with the parent project as part of the group id/path. 我相信,并且看起来像它可行,应该与父项目一起访问它作为组ID /路径的一部分。 Like below... 像下面...

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
    </dependency>    
    <dependency>
      <groupId>com.cisco.ciscossl.CiscoJ</groupId>
      <artifactId>CiscoJ-dist</artifactId>
      <classifier>${os.family}-${os.arch}</classifier>
      <version>1.00</version>
    </dependency>
</dependencies>

khmarbaise, much appreciated to comments of the above. khmarbaise,非常感谢以上评论。 Leaving open for now until further determine that this wasn't the valid answer. 暂时搁置,直到进一步确定这不是有效答案。 At least for now I can see a valid dependency tree being picked up.... 至少到目前为止,我可以看到一个有效的依赖树。

[INFO] Building test-CiscoJ-disk 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ test-CiscoJ-dist ---
[INFO] com.cisco.ciscossl:test-CiscoJ-dist:jar:0.0.1-SNAPSHOT
[INFO] +- junit:junit:jar:4.11:compile
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] \- com.cisco.ciscossl.CiscoJ:CiscoJ-dist:jar:unix-amd64:1.00:compile
[INFO]    +- org.slf4j:slf4j-simple:jar:1.7.2:compile
[INFO]    \- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] ------------------------------------------------------------------------

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM