Maven plugin and "key can't be empty" error

1,625 views
Skip to first unread message

vcalvello

unread,
Jul 19, 2011, 6:17:28 PM7/19/11
to Jenkins Developers
Hey guys,

I'm using the FlexMojos maven plugin. We've just migrated to a new
Jenkins box and now we're getting the error below.
They used to work in our old instance. Goals are running ok from
command line.

Any idea?

Thanks,
Vic

[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] key can't be empty

[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: key can't be
empty
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:
719)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:
556)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:
535)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:
387)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:
348)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:
180)
at
org.apache.maven.lifecycle.LifecycleExecutorInterceptor.execute(LifecycleExecutorInterceptor.java:
65)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
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.classworlds.Launcher.launchEnhanced(Launcher.java:
315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at hudson.maven.agent.Main.launch(Main.java:173)
at hudson.maven.MavenBuilder.call(MavenBuilder.java:164)
at hudson.maven.MavenModuleSetBuild
$Builder.call(MavenModuleSetBuild.java:868)
at hudson.maven.MavenModuleSetBuild
$Builder.call(MavenModuleSetBuild.java:799)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:270)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.apache.maven.plugin.MojoExecutionException: key can't
be empty
at
org.sonatype.flexmojos.compiler.AbstractCompilerMojo.callCompiler(AbstractCompilerMojo.java:
1137)
at
org.sonatype.flexmojos.compiler.AbstractCompilerMojo.run(AbstractCompilerMojo.java:
2403)
at
org.sonatype.flexmojos.AbstractIrvinMojo.execute(AbstractIrvinMojo.java:
155)
at
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:
490)
at
hudson.maven.agent.PluginManagerInterceptor.executeMojo(PluginManagerInterceptor.java:
182)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:
694)
... 28 more
Caused by: java.lang.IllegalArgumentException: key can't be empty
at java.lang.System.checkKey(System.java:774)
at java.lang.System.getProperty(System.java:647)
at
flex2.compiler.config.SystemPropertyConfigurator.load(SystemPropertyConfigurator.java:
43)
at flex2.tools.Mxmlc.processConfiguration(Mxmlc.java:569)
at flex2.tools.Mxmlc.processConfiguration(Mxmlc.java:561)
at
flex2.tools.oem.internal.OEMUtil.getLibraryConfiguration(OEMUtil.java:
309)
at
flex2.tools.oem.internal.OEMUtil.getLibraryConfiguration(OEMUtil.java:
281)
at flex2.tools.oem.Library.compile(Library.java:1322)
at flex2.tools.oem.Library.build(Library.java:653)
at
org.sonatype.flexmojos.compiler.AbstractCompilerMojo.callCompiler(AbstractCompilerMojo.java:
1119)
... 33 more
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 9 seconds
[INFO] Finished at: Tue Jul 19 16:06:25 CDT 2011
[INFO] Final Memory: 46M/335M
[INFO]
------------------------------------------------------------------------
channel stopped
Finished: FAILURE

Jerome Lacoste

unread,
Jul 19, 2011, 6:59:33 PM7/19/11
to jenkin...@googlegroups.com
On Wednesday, July 20, 2011 12:17:28 AM UTC+2, vcalvello wrote:
> Hey guys,

> I'm using the FlexMojos maven plugin. We've just migrated to a new
> Jenkins box and now we're getting the error below.
> They used to work in our old instance. Goals are running ok from
> command line.

> Any idea? 

> Caused by: java.lang.IllegalArgumentException: key can't be empty
> at java.lang.System.checkKey(System.java:774)
> at java.lang.System.getProperty(System.java:647)
> at  flex2.compiler.config.SystemPropertyConfigurator.load(SystemPropertyConfigurator.java:

Short story: the MavenBuilder is passing a system property with an empty key.

Are you 100% sure that your config is expanded properly ? Is your system environment identical on both systems ?

For more details:
if we assume the code is similar in your example, the code tries to do something like:

System.getProperty( "" );

In my version of the JDK, I can't set an empty system property but I can pass an empty key to the system properties :)

class Test {
  public static void main(String[] args) {
    try {
      System.setProperty("", "ho");
      throw new RuntimeException("Expected failure");
    } catch(IllegalArgumentException e) {
      System.out.println("We can' set the empty key:" + e.getMessage());
    }
    try {
      System.getProperties().put("", "ho");
      throw new RuntimeException("Expected failure");
    } catch(IllegalArgumentException e) {
      System.out.println("We can' set the empty key:" + e.getMessage());
    }
  }
}

prints

We can' set the empty key:key can't be empty
Exception in thread "main" java.lang.RuntimeException: Expected failure
at Test.main(Test.java:14)


This is exactly what the MavenBuilder fails to verify 

            // working around NPE when someone puts a null value into systemProps.
            for (Map.Entry<String,String> e : systemProps.entrySet()) {
                if (e.getValue()==null)
                    throw new IllegalArgumentException("System property "+e.getKey()+" has a null value");
                System.getProperties().put(e.getKey(), e.getValue());
            }

Note: I will send a patch that will detect the problem earlier. It won't fix your problem. Check your environment.

J

Victor Calvello

unread,
Jul 20, 2011, 11:12:45 AM7/20/11
to jenkin...@googlegroups.com
My bad!!!!! I found I had a global property field empty on Jenkins config.

Thanks J,
Vic
Reply all
Reply to author
Forward
0 new messages