我已经从此处下载了一个名为WebGraph的软件包的资源:http://webgraph.di.unimi.it/webgraph-3.6.1-src.tar.gz,将其解压缩并从IntellijIdea中打开它(一路为该项目设置了SDK)。到目前为止,一切都很好。
现在,某些pom-model.xmlivy.xml文件具有以下内容:

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>it.unimi.dsi</groupId>
  <artifactId>${ivy.pom.artifactId}</artifactId>
  <packaging>jar</packaging>
  <name>WebGraph</name>
  <version>${ivy.pom.version}</version>
  <description>WebGraph is a framework to study the web graph. It provides simple ways to manage very large graph, exploiting modern compression techniques.</description>
  <url>http://webgraph.dsi.unimi.it/</url>
  <licenses>
    <license>
      <name>GNU General Public License Version 3+</name>
      <url>http://www.gnu.org/licenses/gpl.html</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <connection>scm:git://github.com/vigna/WebGraph.git</connection>
    <url>https://github.com/vigna/WebGraph</url>
  </scm>
  <developers>

    <developer>
      <id>boldi</id>
      <name>Paolo Boldi</name>
      <email>[email protected]</email>
    </developer>

    <developer>
      <id>vigna</id>
      <name>Sebastiano Vigna</name>
      <email>[email protected]</email>
    </developer>

  </developers>
</project>




<?xml version="1.0" encoding="ISO-8859-1"?>
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
    <info organisation="it.unimi.dsi" module="webgraph"/>

    <configurations defaultconf="compile" defaultconfmapping="*->default">
        <conf name="compile"/>
        <conf name="runtime" extends="compile"/>
        <conf name="test" extends="runtime"/>
    </configurations>

    <dependencies>

        <dependency org="it.unimi.dsi" name="fastutil" rev="latest.release" />
        <dependency org="it.unimi.dsi" name="sux4j" rev="latest.release" />
        <dependency org="it.unimi.dsi" name="dsiutils" rev="latest.release" />
        <dependency org="net.sf.jung" name="jung-api" rev="latest.release"/>
        <dependency org="net.sf.jung" name="jung-io" rev="latest.release"/>
        <dependency org="com.martiansoftware" name="jsap" rev="latest.release"/>
        <dependency org="junit" name="junit" rev="latest.release" conf="test"/>
        <dependency org="emma" name="emma" rev="latest.release" conf="test"/>
        <dependency org="emma" name="emma_ant" rev="latest.release" conf="test"/>

        <dependency org="ch.qos.logback" name="logback-classic" rev="latest.release" conf="runtime"/>
        <dependency org="commons-configuration" name="commons-configuration" rev="latest.release"/>
        <dependency org="org.apache.commons" name="commons-lang3" rev="latest.release"/>
    </dependencies>
</ivy-module>


此软件包还需要其他库:http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22it.unimi.dsi%22

现在,该包中有一个特定的示例类,它包含一个main函数。我想使用某些命令行参数来运行它。
它位于名称为it.unimi.dsi.webgraph.examples的程序包BreadthFirst.java中。
我在这里描述的似乎是一个相当普通的场景,因此一种解决方案可能会使许多人受益。作为Maven和Java基础架构的新手,我很高兴学习下一步要做的事情。在这种情况下我应该寻找什么?到目前为止,当我尝试运行项目时,输出为:

/usr/lib/jvm/jdk1.8.144/bin/java -Dmaven.multiModuleProjectDirectory=/home/sj/Downloads/webgraph-3.6.1 -Dmaven.home=/usr/local/idea-IC-173.4548.28/plugins/maven/lib/maven3 -Dclassworlds.conf=/usr/local/idea-IC-173.4548.28/plugins/maven/lib/maven3/bin/m2.conf -Didea.launcher.port=37307 -Didea.launcher.bin.path=/usr/local/idea-IC-173.4548.28/bin -Dfile.encoding=UTF-8 -classpath /usr/local/idea-IC-173.4548.28/plugins/maven/lib/maven3/boot/plexus-classworlds-2.5.2.jar:/usr/local/idea-IC-173.4548.28/lib/idea_rt.jar com.intellij.rt.execution.application.AppMainV2 org.codehaus.classworlds.Launcher -Didea.version=2017.3.4
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'artifactId' contains an expression but should be a constant. @ line 4, column 15
[WARNING] 'version' contains an expression but should be a constant. @ line 7, column 12
[ERROR] 'artifactId' with value '${ivy.pom.artifactId}' does not match a valid id pattern. @ line 4, column 15
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project it.unimi.dsi:${ivy.pom.artifactId}:${ivy.pom.version} (/home/sj/Downloads/webgraph-3.6.1/pom.xml) has 1 error
[ERROR]     'artifactId' with value '${ivy.pom.artifactId}' does not match a valid id pattern. @ line 4, column 15
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException


编辑:潜在地,我想修改代码,因此将其构建为独立项目对我来说至关重要。

最佳答案

您是否只是在尝试在程序中使用此库?如果是这样,我建议您仅将依赖项添加到您的主pom.xml文件中。这是版本3.6.1的依赖项:

<!-- https://mvnrepository.com/artifact/it.unimi.dsi/webgraph -->
<dependency>
    <groupId>it.unimi.dsi</groupId>
    <artifactId>webgraph</artifactId>
    <version>3.6.1</version>
    <scope>runtime</scope>
</dependency>


maven repository webpage所示,它具有许多“编译依赖项”,因此请确保也将这些依赖项都添加到pom中。

09-27 23:55