nar-maven-plugin> = 3.3.0失败,并且“未指定msvc.version”

时间:2016-03-31 19:20:24

标签: c maven gcc cygwin

我想在一台带有Maven和Cygwin的gcc的Windows机器上构建一个helloworld C程序。使用nar-maven-plugin版本3.2.3构建成功,但如果使用像3.4.0这样的更高版本,则构建总是失败

  

[错误]无法在项目helloworld上执行目标com.github.maven-nar:nar-maven-plugin:3.4.0:nar-validate(default-nar-validate):未指定msvc.version且没有VSCOMNTOOLS环境

为什么?我不想使用Microsoft编译器。

我的项目结构:

    src/main/c/helloworld.c
    pom.xml

我的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>com.foo.bar</groupId>
<artifactId>helloworld</artifactId>
<packaging>nar</packaging>
<version>1.0-SNAPSHOT</version>

<build>
    <plugins>
        <plugin>
            <groupId>com.github.maven-nar</groupId>
            <artifactId>nar-maven-plugin</artifactId>
            <version>3.4.0</version>
            <extensions>true</extensions>
            <configuration>
                <c>
                    <name>gcc</name>
                    <includes>
                        <include>**/*.c</include>
                    </includes>
                </c>
                <linker>
                    <name>gcc</name>
                </linker>
                <libraries>
                    <library>
                        <type>executable</type>
                        <run>false</run>
                    </library>
                </libraries>
            </configuration>
        </plugin>
    </plugins>
</build>

我的构建输出:

    C:\CC4\c_test>which gcc
    C:\cygwin64\bin\gcc.EXE

    C:\CC4\c_test>gcc --version
    gcc (GCC) 5.3.0
    Copyright (C) 2015 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    C:\CC4\c_test>mvn clean install
    ### C:\Users\jokroebe\mavenrc_pre.bat
    ### Set JAVA_HOME for maven to C:\Program Files\Java\jdk1.7.0_80
    ### Set MAVEN_OPTS to -Xmx1024m -XX:MaxPermSize=512m

    [INFO] Scanning for projects...
    [INFO]
    [INFO]             ------------------------------------------------------------------------
    [INFO] Building helloworld 1.0-SNAPSHOT
    [INFO]                 ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ helloworld ---
    [INFO] Deleting C:\CC4\c_test\target
    [INFO]
    [INFO] --- nar-maven-plugin:3.4.0:nar-validate (default-nar-validate) @ helloworld ---
    [INFO]         ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO]         ------------------------------------------------------------------------
    [INFO] Total time: 5.436 s
    [INFO] Finished at: 2016-03-31T20:45:42+02:00
    [INFO] Final Memory: 9M/154M
    [INFO]         ------------------------------------------------------------------------
    [ERROR] Failed to execute goal com.github.maven-nar:nar-maven-plugin:3.4.0:nar-validate (default-nar-validate) on project helloworld: msvc.version not specified and no VS<Version>COMNTOOLS environment
     variable can be found -> [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/MojoExecutionException

0 个答案:

没有答案