jar的POM无效,传递依赖项将不可用 [英] The POM for jar is invalid, transitive dependencies will not be available

查看:167
本文介绍了jar的POM无效,传递依赖项将不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Eclipse中为我的Maven项目提供外部依赖.因此,我将jar文件及其POM.xml直接复制到了本地Maven存储库中.但是Eclipse以某种方式抱怨该jar的POM无效.

I want to provide external dependency to my maven project in eclipse. Therefore, I ave copied the jar file and its POM.xml directly in the local Maven Repository. But somehow Eclipse is complaining that the POM for the jar is invalid.

我的本​​地存储库中的jar文件的pom.xml如下所示:

My pom.xml for jar file in local Repository looks like below:

<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>
    <groupId>com.b.t</groupId>
    <artifactId>v-parent</artifactId>
    <version>3.9.0</version>
  </parent>

  <scm>
        <developerConnection>scm:svn:url/</developerConnection>
    </scm>

  <artifactId>v-p</artifactId>
  <version>1.1.0</version>
  <name>p</name>
  <build>
    <plugins>
      <!-- Plugin required to build java classes from XSD using XJC -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>1.5</version>
        <executions>
          <execution>
            <id>xjc</id>
            <goals>
              <goal>xjc</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <arguments>-npa</arguments>
          <schemaDirectory>${project.basedir}/src/main/resources</schemaDirectory>
          <packageName>com.b.t.v.fusion.p.generated</packageName>
          <schemaFiles>pConfig.xsd</schemaFiles>
          <outputDirectory>${basedir}/target/generated-sources</outputDirectory>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>  
      <plugins>      
        <!-- Plugin required to add the generated sources to the classpath -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>build-helper-maven-plugin</artifactId>
          <version>1.8</version>
          <executions>
            <execution>
              <phase>generate-sources</phase>
              <goals>
                <goal>add-source</goal>
              </goals>
              <configuration>
                <sources>
                  <source>${basedir}/target/generated-sources</source>
                </sources>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>  
  </build>


  <dependencies> 
      <dependency>
        <groupId>com.b.t</groupId>
        <artifactId>v-fusioninterface</artifactId>
      </dependency> 
      <dependency>
        <!-- FFT -->
        <groupId>com.github.wendykierp</groupId>
        <artifactId>JTransforms</artifactId>
        <version>3.1</version>
      </dependency>
      <dependency>
        <!-- Reading and writing of MATLAB files -->
        <groupId>net.sourceforge.jmatio</groupId>
        <artifactId>jmatio</artifactId>
        <version>1.0</version>
      </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
      </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <profiles>
  <profile>
    <id>doclint-java8-disable</id>
    <activation>
      <jdk>[1.8,)</jdk>
    </activation>

    <build>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <configuration>
            <additionalparam>-Xdoclint:none</additionalparam>
          </configuration>
        </plugin>
      </plugins>
    </build>
  </profile>
</profiles> 
</project>

我已经检查了类似的帖子,并在eclipse.ini中进行了必要的更改(将JDK的JRE指定为vmargs n all).我对MAven Project的依赖如下所示:

I have already checked similar posts and have done necessary changes in eclipse.ini (specifying JDK's JRE as vmargs n all). My dependency in MAven Project looks like below:

<dependency>
            <groupId>com.b.t</groupId>
            <artifactId>v-p</artifactId>
            <version>1.1.0</version>
        </dependency>

请注意,带有相应POM.xml的同一个jar文件对于我的Intellij同事来说效果很好.

Please note that the same jar file with corresponding POM.xml is working well for my colleague in Intellij.

我仅使用Eclipse Luna来获取信息.我还在Eclipse中检查了已安装的JRE为jdk1.8.0_144.

I am using Eclipse Luna just for info. I also have checked in my Eclipse that the Installed JRE is jdk1.8.0_144.

在命令提示符下使用mvn clean install时,我也遇到相同的错误.

Also I am getting the same error when I use mvn clean install on command prompt.

有人可以建议我进一步检查什么吗?

Could someone please suggest what can I check more ?

推荐答案

您不能仅将文件复制到本地存储库中,而需要安装它们.这里有说明: https://maven.apache .org/guides/mini/guide-3rd-party-jars-local.html

You cannot just copy the files into your local repo, you need to install them. There are instructions here: https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

在您的情况下是这样的:

In your case is would be something like:

mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>

这篇关于jar的POM无效,传递依赖项将不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆