经过一天的努力并阅读了很多关于此的话题,我仍然有问题!我使用Debian 8 jessie并使用以下命令安装maven:
apt-get install maven
这是此命令的结果:mvn -version
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_111, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-4-amd64", arch: "amd64", family: "unix"
我也用过:git clone https://bitbucket.org/axelclk/info.bliki.wiki.git
获取bliki。然后我去了它的目录并尝试了这个命令:
mvn install -DskipTests
但我得到了这个结果:
root@localhost:/home/m/info.bliki.wiki# mvn install -DskipTests
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 4 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 4 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Bliki POM
[INFO] Bliki (Core)
[INFO] Bliki (PDF)
[INFO] Bliki (Addons)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Bliki POM 3.1.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-javadoc-plugin:2.10.3:jar (attach-javadocs) @ bliki ---
[INFO] Not executing Javadoc as the project is not a Java classpath-capable package
[INFO]
[INFO] --- maven-source-plugin:3.0.0:jar-no-fork (attach-sources) @ bliki ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ bliki ---
[INFO] Installing /home/m/info.bliki.wiki/pom.xml to /root/.m2/repository/info/bliki/wiki/bliki/3.1.1-SNAPSHOT/bliki-3.1.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Bliki (Core) 3.1.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.4.0:exec (git submodule update) @ bliki-core ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ bliki-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 25 resources
[INFO] Copying 9 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ bliki-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 273 source files to /home/m/info.bliki.wiki/bliki-core/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ bliki-core ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 35 resources
[INFO] Copying 141 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ bliki-core ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 95 source files to /home/m/info.bliki.wiki/bliki-core/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/api/query/ParseTest.java:[15,9] cannot access java.util.concurrent.CompletableFuture
class file for java.util.concurrent.CompletableFuture not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/extensions/scribunto/engine/lua/LuaTestBase.java:[65,17] cannot access java.util.Optional
class file for java.util.Optional not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[12,9] cannot access java.util.OptionalDouble
class file for java.util.OptionalDouble not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[20,9] cannot access java.util.OptionalInt
class file for java.util.OptionalInt not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[25,9] cannot access java.util.OptionalLong
class file for java.util.OptionalLong not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[31,9] cannot access java.time.ZonedDateTime
class file for java.time.ZonedDateTime not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[36,9] cannot access java.time.LocalDateTime
class file for java.time.LocalDateTime not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[41,9] cannot access java.time.OffsetDateTime
class file for java.time.OffsetDateTime not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[46,9] cannot access java.time.OffsetTime
class file for java.time.OffsetTime not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[51,9] cannot access java.time.LocalTime
class file for java.time.LocalTime not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[56,9] cannot access java.time.LocalDate
class file for java.time.LocalDate not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[62,9] cannot access java.util.stream.Stream
class file for java.util.stream.Stream not found
[INFO] 12 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Bliki POM ......................................... SUCCESS [3.093s]
[INFO] Bliki (Core) ...................................... FAILURE [14.456s]
[INFO] Bliki (PDF) ....................................... SKIPPED
[INFO] Bliki (Addons) .................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.122s
[INFO] Finished at: Fri Sep 30 21:30:18 IRST 2016
[INFO] Final Memory: 25M/227M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project bliki-core: Compilation failure: Compilation failure:
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/api/query/ParseTest.java:[15,9] cannot access java.util.concurrent.CompletableFuture
[ERROR] class file for java.util.concurrent.CompletableFuture not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/extensions/scribunto/engine/lua/LuaTestBase.java:[65,17] cannot access java.util.Optional
[ERROR] class file for java.util.Optional not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[12,9] cannot access java.util.OptionalDouble
[ERROR] class file for java.util.OptionalDouble not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[20,9] cannot access java.util.OptionalInt
[ERROR] class file for java.util.OptionalInt not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[25,9] cannot access java.util.OptionalLong
[ERROR] class file for java.util.OptionalLong not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[31,9] cannot access java.time.ZonedDateTime
[ERROR] class file for java.time.ZonedDateTime not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[36,9] cannot access java.time.LocalDateTime
[ERROR] class file for java.time.LocalDateTime not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[41,9] cannot access java.time.OffsetDateTime
[ERROR] class file for java.time.OffsetDateTime not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[46,9] cannot access java.time.OffsetTime
[ERROR] class file for java.time.OffsetTime not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[51,9] cannot access java.time.LocalTime
[ERROR] class file for java.time.LocalTime not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[56,9] cannot access java.time.LocalDate
[ERROR] class file for java.time.LocalDate not found
[ERROR] /home/m/info.bliki.wiki/bliki-core/src/test/java/info/bliki/wiki/filter/HTTPUrlFilterTest.java:[62,9] cannot access java.util.stream.Stream
[ERROR] class file for java.util.stream.Stream not found
[ERROR] -> [Help 1]
[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/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :bliki-core
我是Linux的新手,并且不太了解它的命令和错误!我还在我的pom.XML文件中添加了这些行,但没有任何意义!
<dependencies>
<dependency>
<groupId>info.bliki.wiki</groupId>
<artifactId>bliki-core</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>info.bliki.wiki</groupId>
<artifactId>bliki-core</artifactId>
<version>3.1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
这是我的pom.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>info.bliki.wiki</groupId>
<artifactId>bliki</artifactId>
<packaging>pom</packaging>
<name>Bliki POM</name>
<version>3.1.1-SNAPSHOT</version>
<description>
The Bliki API is a Java-based Wiki to HTML renderer with MediaWiki syntax support.
</description>
<url>https://bitbucket.org/axelclk/info.bliki.wiki</url>
<organization>
<name>Java Wikipedia API (Bliki engine)</name>
<url>https://bitbucket.org/axelclk/info.bliki.wiki</url>
</organization>
<developers>
<developer>
<id>axelclk</id>
<name>Axel Kramer</name>
</developer>
<developer>
<id>jberkel</id>
<name>Jan Berkel</name>
</developer>
</developers>
<scm>
<connection>scm:git:https://bitbucket.org/axelclk/info.bliki.wiki.git</connection>
<developerConnection>scm:git:ssh://git@bitbucket.org/axelclk/info.bliki.wiki.git</developerConnection>
<tag>master</tag>
<url>https://bitbucket.org/axelclk/info.bliki.wiki/src</url>
</scm>
<issueManagement>
<system>Bitbucket</system>
<url>https://bitbucket.org/axelclk/info.bliki.wiki/issues</url>
</issueManagement>
<ciManagement>
<url>https://drone.io/bitbucket.org/axelclk/info.bliki.wiki</url>
</ciManagement>
<licenses>
<license>
<name>Eclipse Public License 1.0</name>
<url>http://www.opensource.org/licenses/eclipse-1.0.php</url>
<distribution>repo</distribution>
</license>
<license>
<name>GNU Lesser General Public License - v 2.1 or later</name>
<url>http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<modules>
<module>bliki-core</module>
<module>bliki-pdf</module>
<module>bliki-addons</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>info.bliki.wiki</groupId>
<artifactId>bliki-core</artifactId>
<version>3.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>info.bliki.wiki</groupId>
<artifactId>bliki-pdf</artifactId>
<version>3.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>info.bliki.wiki</groupId>
<artifactId>bliki-addons</artifactId>
<version>3.1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.luaj</groupId>
<artifactId>luaj-jse</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.12.1.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.17</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>software.betamax</groupId>
<artifactId>betamax-junit</artifactId>
<version>2.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-Werror</arg>
<arg>-Xlint:all</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<tagNameFormat>@{project.version}</tagNameFormat>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.9.4</version>
<configuration>
<connectionType>developerConnection</connectionType>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.6</version>
<extensions>true</extensions>
<configuration>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<serverId>sonatype-oss-staging</serverId>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<argLine>-Dio.netty.leakDetectionLevel=simple -Dfile.encoding=UTF-8</argLine>
<!--<excludedGroups>info.bliki.annotations.IntegrationTest</excludedGroups>-->
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>sonatype-oss-staging</id>
<url>https://oss.sonatype.org/content/repositories/staging</url>
</repository>
<snapshotRepository>
<id>sonatype-oss-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
</repositories>
</project>
<dependencies>
<dependency>
<groupId>info.bliki.wiki</groupId>
<artifactId>bliki-core</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>info.bliki.wiki</groupId>
<artifactId>bliki-core</artifactId>
<version>3.1.1-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>sonatype-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
</plugin>
</plugins>
</pluginManagement>
</build>
答案 0 :(得分:2)
您使用的是Java 1.7版
java.util.concurrent.CompletableFuture
,java.util.Optional
,java.util.OptionalDouble
,java.time.ZonedDateTime
,etc
都是Java 1.8中引入的新功能。它们不存在于Java 1.7中。
要摆脱这些错误,请将Java版本更新为1.8。