Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven compilation error. Failure executing javac, but could not parse the error:javac: invalid flag: -s

Tags:

java

maven

I am getting a compilation error when try to execute mvn clean install.

 [ERROR] COMPILATION ERROR :
    [INFO] -------------------------------------------------------------
    [ERROR] Failure executing javac, but could not parse the error:
    javac: invalid flag: -s
    Usage: javac <options> <source files>

Java version is

java version "1.6.0_31"
Java(TM) SE Runtime Environment (build 1.6.0_31-b05)
Java HotSpot(TM) Client VM (build 20.6-b01, mixed mode, sharing)

Maven version

Apache Maven 3.0.3 (r1075438; 2011-02-28 11:31:09-0600)
Maven home: C:\Sajith\apache-maven-3.0.3\apache-maven-3.0.3
Java version: 1.5.0_16, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.5.0_16\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows xp", version: "5.1", arch: "x86", family: "windows"

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.test.sample</groupId>
    <artifactId>TestApp</artifactId>
    <description>TestApp Release 1.0 Build</description>
    <version>2.0</version>
    <packaging>pom</packaging>
    <name>TestApp API</name>
    <url>http://maven.apache.org</url>

Any help would be appreciated.

like image 637
Sajith Avatar asked Dec 22 '13 19:12

Sajith


2 Answers

The problem is that your maven is using java 5 (as your comment says). You have to change your JAVA_HOME variable to point to jdk 6 or higher. Look at :

Error when using javac: "javac: invalid flag: -s"

like image 53
Viktor K. Avatar answered Oct 08 '22 04:10

Viktor K.


In my case i dont have the apropiate environment variable because the project is inherited, and I had not created the variable JDK_WAS85_JDK8 = C:\Program Files\Java\jdk1.8.0_221. Usually is JAVA_HOME the variable that is set. father pom.xml

like image 1
Pichitron Avatar answered Oct 08 '22 02:10

Pichitron