使用Maven构建Liferay项目时出现NullPointerException

时间:2015-04-07 00:00:48

标签: java maven nullpointerexception liferay

我使用Maven而不是Ant创建Liferay插件。

问题是在某些开发环境中,当我尝试运行 mvn clean package 时,我遇到以下异常:

[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException
    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.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 org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException
    at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:88)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    ... 17 more
Caused by: java.lang.NullPointerException
    at com.liferay.maven.plugins.AbstractLiferayMojo.getProjectClassPath(AbstractLiferayMojo.java:268)
    at com.liferay.maven.plugins.AbstractLiferayMojo.getProjectClassLoader(AbstractLiferayMojo.java:255)
    at com.liferay.maven.plugins.SassToCssBuilderMojo.doExecute(SassToCssBuilderMojo.java:90)
    at com.liferay.maven.plugins.AbstractLiferayMojo.execute(AbstractLiferayMojo.java:81)
    ... 19 more

我已经有了解决这个问题的答案,我只是添加这个问题来分享这些知识;我无法在任何地方找到这个错误。

2 个答案:

答案 0 :(得分:1)

该错误与插件本身无关,而是与Maven的版本有关。当您尝试使用旧版本的Maven构建Liferay项目时,会引发错误。

当我们将Maven更新到v3.0.5时,离开时的错误和项目正确构建。

答案 1 :(得分:0)

你试过跑步吗?

clean package liferay:deploy