GVKun编程网logo

无法使用MAVEN进行编译并出现错误-无法执行目标org.apache.maven.plugins:maven-compiler- plugin:3.1:compile

13

对于无法使用MAVEN进行编译并出现错误-无法执行目标org.apache.maven.plugins:maven-compiler-plugin:3.1:compile感兴趣的读者,本文将提供您所需

对于无法使用MAVEN进行编译并出现错误-无法执行目标org.apache.maven.plugins:maven-compiler- plugin:3.1:compile感兴趣的读者,本文将提供您所需要的所有信息,并且为您提供关于build.plugins.plugin.version'' for org.apache.maven.plugins:maven-compiler-pl、Failed to execute goal org.apache.maven.plugins:maven-compiler-plugi、Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:、Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compil...的宝贵知识。

本文目录一览:

无法使用MAVEN进行编译并出现错误-无法执行目标org.apache.maven.plugins:maven-compiler- plugin:3.1:compile

无法使用MAVEN进行编译并出现错误-无法执行目标org.apache.maven.plugins:maven-compiler- plugin:3.1:compile

我一直在尝试使用Maven构建代码。但是我陷入了错误。该代码可在此github存储库上找到。谷歌播放爬虫

我的系统配置如下所示:

Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 19:21:28+0530)Maven home: /Users/tushar/Downloads/apache-maven-3.0.5Java version: 1.6.0_65, vendor: Apple Inc.Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/HomeDefault locale: en_US, platform encoding: MacRomanOS name: "mac os x", version: "10.9", arch: "x86_64", family: "mac"

以下是该错误的Maven跟踪:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project googleplaycrawler: Compilation failure -> [Help 1]org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project googleplaycrawler: Compilation failure    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)    at java.lang.reflect.Method.invoke(Method.java:597)    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:862)    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)    ... 19 more[ERROR] [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

这是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/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <groupId>com.akdeniz</groupId>    <artifactId>googleplaycrawler</artifactId>    <version>0.3</version>    <packaging>jar</packaging>    <name>Google Play Crawler</name>    <url>https://github.com/Akdeniz/google-play-crawler</url>    <description>Play with Google Play API :)</description>    <properties>        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>    </properties>    <dependencies>        <dependency>            <groupId>org.apache.httpcomponents</groupId>            <artifactId>httpclient</artifactId>            <version>4.2.2</version>        </dependency>        <dependency>            <groupId>commons-logging</groupId>            <artifactId>commons-logging</artifactId>            <version>1.1.1</version>        </dependency>        <dependency>            <groupId>net.sourceforge.argparse4j</groupId>            <artifactId>argparse4j</artifactId>            <version>0.2.2</version>        </dependency>        <dependency>            <groupId>org.apache.httpcomponents</groupId>            <artifactId>httpcore</artifactId>            <version>4.2.2</version>        </dependency>        <dependency>            <groupId>org.apache.httpcomponents</groupId>            <artifactId>httpclient-cache</artifactId>            <version>4.2.2</version>        </dependency>        <dependency>            <groupId>org.apache.httpcomponents</groupId>            <artifactId>httpmime</artifactId>            <version>4.2.2</version>        </dependency>        <dependency>            <groupId>org.apache.mina</groupId>            <artifactId>mina-core</artifactId>            <version>2.0.7</version>        </dependency>        <dependency>            <groupId>org.slf4j</groupId>            <artifactId>slf4j-simple</artifactId>            <version>1.7.2</version>        </dependency>        <dependency>            <groupId>com.google.protobuf</groupId>            <artifactId>protobuf-java</artifactId>            <version>2.5.0</version>        </dependency>        <dependency>            <groupId>org.testng</groupId>            <artifactId>testng</artifactId>            <version>6.1.1</version>            <scope>test</scope>        </dependency>    </dependencies>    <pluginRepositories>        <pluginRepository>            <id>protoc-plugin</id>            <url>http://sergei-ivanov.github.com/maven-protoc-plugin/repo/releases/</url>        </pluginRepository>    </pluginRepositories>    <build>        <plugins>            <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>                    <fork>true</fork                    <executable>${JAVA_1_7_HOME}/bin/javac</executable>                    <encoding>UTF-8</encoding>                </configuration>            </plugin>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-assembly-plugin</artifactId>                <version>2.3</version>                <executions>                    <execution>                        <goals>                            <goal>attached</goal>                        </goals>                        <phase>package</phase>                        <configuration>                            <descriptorRefs>                                <descriptorRef>jar-with-dependencies</descriptorRef>                            </descriptorRefs>                            <archive>                                <manifest>                                    <mainClass>com.akdeniz.googleplaycrawler.cli.googleplay</mainClass>                                </manifest>                            </archive>                        </configuration>                    </execution>                </executions>            </plugin>            <plugin>                <groupId>com.google.protobuf.tools</groupId>                <artifactId>maven-protoc-plugin</artifactId>                <version>0.3.1</version>                <configuration>                    <protocExecutable>protoc</protocExecutable>                    <protoSourceRoot>${project.basedir}/src/main/protobuf/</protoSourceRoot>                    <languageSpecifications>                        <LanguageSpecification>                            <language>JAVA</language>                            <outputDirectory>${project.basedir}/src/main/java</outputDirectory>                        </LanguageSpecification>                    </languageSpecifications>                </configuration>                <executions>                    <execution>                        <goals>                            <goal>compile</goal>                        </goals>                    </execution>                </executions>            </plugin>        </plugins>    </build></project>

答案1

小编典典

您的Maven正在读取Java版本为1.6.0_65,而pom.xml表示该版本为1.7。

尝试安装所需的版本。

如果已安装,请检查$ JAVA_HOME环境变量,它应包含Java JDK 7的路径。如果找不到,请修复环境变量。

也删除线

 <fork>true</fork>     <executable>${JAVA_1_7_HOME}/bin/javac</executable>

来自 pom.xml

build.plugins.plugin.version'' for org.apache.maven.plugins:maven-compiler-pl

build.plugins.plugin.version'' for org.apache.maven.plugins:maven-compiler-pl

字面意思就是没有指定版本信息 ,警告问题:程序可以运行

增加一行 

<version>2.3.2</version>  用来指定版本信息

 

 <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>  
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

 

 

OK了

 

Using platform encoding (UTF-8 actually) to copy filtered resources

虽然并不影响项目的正常运行和install,但是不想看到这警告的发生。

加上(可加在在结尾处)

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

如下:

 <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>  
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>
    

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

 

 

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugi

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugi

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project mlib: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[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.

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:

BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.959 s
[INFO] Finished at: 2017-10-17T17:29:50+08:00
[INFO] Final Memory: 16M/217M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project JerseyRestFul: Compilation failure
[ERROR] /D:/360c/JerseyRestFul-master/src/main/java/com/zeusjava/resource/UserResource.java:[8,22] D:\360c\JerseyRestFul-master\src\main\java\com\zeusjava\resource\UserResource.java:8: 无法访问 javax.xml.bind.JAXBElement
[ERROR] 错误的类文件: javax\xml\bind\JAXBElement.class (javax\xml\bind:JAXBElement.class)
[ERROR] 类文件具有错误的版本 52.0,应为 50.0
[ERROR] 请删除该文件或确保该文件位于正确的类路径子目录中。
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compil...

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compil...

本文为博主原创,未经允许不得转载:

[INFO] Finished at: 2018-09-19T20:26:05+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ppcloud-common: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[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 :ppcloud-common

在新下载的项目中进行 maven 的 jar 的更新和下载时,报此错,在网上搜了其他的文章,需要在 eclipse 中安装 jdk,
选择 window→preference→java→Installed JREs 点 add 添加你的 jdk 路径,选 jdk 而不是 jre.
然后就可以解决该问题,当我操作结束重新尝试的时候,仍然报次错,
然后我在 dos 窗口中 ping 了一下,我在 setting 配置中的 maven 镜像地址的域名,
发现 ping 不同,我更换了可以使用的 ip,然后重新尝试就 ok 了。

我们今天的关于无法使用MAVEN进行编译并出现错误-无法执行目标org.apache.maven.plugins:maven-compiler- plugin:3.1:compile的分享就到这里,谢谢您的阅读,如果想了解更多关于build.plugins.plugin.version'' for org.apache.maven.plugins:maven-compiler-pl、Failed to execute goal org.apache.maven.plugins:maven-compiler-plugi、Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:、Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compil...的相关信息,可以在本站进行搜索。

本文标签: