Weird error of atlassian SDK: "error: strings in switch are not supported in -source 1.6"

Ma Hao January 14, 2014

Hi,

I met a error when i try to compile with "atlas-cli" -> "pi":

[root@localhost tryit]# atlas-cli
Executing: /usr/share/atlassian-plugin-sdk-4.2.10/apache-maven/bin/mvn com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:4.2.10:cli -gs /usr/share/atlassian-plugin-sdk-4.2.10/apache-maven/conf/settings.xml
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building tryit
[INFO]    task-segment: [com.atlassian.maven.plugins:maven-amps-dispatcher-plugin:4.2.10:cli]
[INFO] ------------------------------------------------------------------------
[INFO] artifact org.apache.velocity:velocity: checking for updates from atlassian-public
[INFO] artifact org.apache.velocity:velocity: checking for updates from atlassian-plugin-sdk
[INFO] artifact org.apache.velocity:velocity: checking for updates from central
[INFO] [amps-dispatcher:cli]
[INFO] [jira:cli {execution: virtual-execution}]
[INFO] [cli:execute]
[INFO] Opening port 4330 for socket cli access
[INFO] Waiting for commands...
maven2> pi
[INFO] Executing: com.atlassian.maven.plugins:maven-jira-plugin [copy-bundled-dependencies]
[INFO] [jira:copy-bundled-dependencies {execution: virtual-execution}]
[INFO] [dependency:unpack-dependencies]
[INFO] gson-2.2.2-atlassian-1.jar already exists in destination.
[INFO] Current project: tryit
[INFO] Execution time: 3147 ms
[INFO] Executing: com.atlassian.maven.plugins:maven-jira-plugin [compress-resources]
[INFO] [jira:compress-resources {execution: virtual-execution}]
[INFO] Compiling javascript using YUI
[INFO] Nothing to do, /opt/atlas-plugin/tryit/target/classes/js/tryit-min.js is younger than the original
[INFO] Nothing to do, /opt/atlas-plugin/tryit/target/classes/css/tryit-min.css is younger than the original
[INFO] Compressing XML files
[INFO] Nothing to do, /opt/atlas-plugin/tryit/target/classes/atlassian-plugin.xml is younger than the original
[INFO] Current project: tryit
[INFO] Execution time: 231 ms
[INFO] Executing: org.apache.maven.plugins:maven-resources-plugin [resources]
[INFO] [resources:resources]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 9 resources
[INFO] Current project: tryit
[INFO] Execution time: 407 ms
[INFO] Executing: com.atlassian.maven.plugins:maven-jira-plugin [filter-plugin-descriptor]
[INFO] [jira:filter-plugin-descriptor {execution: virtual-execution}]
[INFO] [resources:copy-resources {execution: virtual-execution}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Current project: tryit
[INFO] Execution time: 107 ms
[INFO] Executing: org.apache.maven.plugins:maven-compiler-plugin [compile]
[INFO] [compiler:compile {execution: virtual-execution}]
[INFO] Compiling 1 source file to /opt/atlas-plugin/tryit/target/classes
[ERROR] Unable to complete running command: pi
java.lang.RuntimeException: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo
	at org.twdata.maven.cli.commands.ExecuteGoalCommand.run(ExecuteGoalCommand.java:112)
	at org.twdata.maven.cli.commands.ExecuteGoalCommand.run(ExecuteGoalCommand.java:107)
	at org.twdata.maven.cli.CliShell.interpretCommand(CliShell.java:48)
	at org.twdata.maven.cli.CliShell.run(CliShell.java:29)
	at org.twdata.maven.cli.AbstractCliMojo.displayShell(AbstractCliMojo.java:170)
	at org.twdata.maven.cli.AbstractCliMojo.access$000(AbstractCliMojo.java:22)
	at org.twdata.maven.cli.AbstractCliMojo$1.run(AbstractCliMojo.java:123)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo
	at org.shaded.mojoexecutor.MojoExecutor.executeMojoImpl(MojoExecutor.java:128)
	at org.shaded.mojoexecutor.MojoExecutor$ExecutionEnvironmentM2.executeMojo(MojoExecutor.java:466)
	at org.shaded.mojoexecutor.MojoExecutor.executeMojo(MojoExecutor.java:80)
	at org.twdata.maven.cli.MojoCall.run(MojoCall.java:33)
	at org.twdata.maven.cli.commands.ExecuteGoalCommand.runMojo(ExecuteGoalCommand.java:126)
	at org.twdata.maven.cli.commands.ExecuteGoalCommand.run(ExecuteGoalCommand.java:105)
	... 6 more
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
/opt/atlas-plugin/tryit/src/main/java/com/winagile/test/servlet/IssueCRUD.java:[307,35] error: strings in switch are not supported in -source 1.6


	at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
	at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
	at org.shaded.mojoexecutor.MojoExecutor.executeMojoImpl(MojoExecutor.java:126)
	... 11 more

But i am sure that i only installed jdk 1.7 on my Centos:

[root@localhost tryit]# rpm -qa |grep jdk
jdk-1.7.0_45-fcs.x86_64
[root@localhost tryit]# echo $JAVA_HOME
/usr/java/jdk1.7.0_45/
[root@localhost tryit]# java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
[root@localhost tryit]# javac -version
javac 1.7.0_45

The Weird thing is, when i tried to restart jira with "atlas-run".

First time, i met the error also,

But after a while, i successfully started jira with "atlas-run", i even do not know what i did, actually i did nothing but search about the error on web browser.

1 answer

1 accepted

2 votes
Answer accepted
Ma Hao January 16, 2014

I suppose it is caused by following configuraion in pom.xml

<plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
            <source>1.6</source>
            <target>1.6</target>
        </configuration>
    </plugin>

I updated to be 1.7 now it is working.

Suggest an answer

Log in or Sign up to answer