The POM for jar is invalid, transitive dependencie

2019-08-18 01:27发布

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.

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>

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>

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

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

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 ?

1条回答
在下西门庆
2楼-- · 2019-08-18 02:23

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>
查看更多
登录 后发表回答