Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven : mvn install results to Compilation failure

When running the command "mvn clean", it returns a build success but when running "mvn install", it returns Compilation failure. Could you please help me out to trace what causing the error? Thanks in advance.

EDIT : Added logs.


[ERROR] \Users...\workspace\project\src\main\java\c
om\project\Interceptor.java:[30,22] cannot find symbo
l
symbol  : variable HttpServletResponse
location: class com.project.Interceptor
[INFO] 49 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.730s
[INFO] Finished at: Thu Mar 08 11:14:16 CST 2012
[INFO] Final Memory: 9M/24M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
3.2:compile (default-compile) on project project: Compilation failure: Co
mpilation failure:
[ERROR] \Users...\workspace\project\src\main\java\c
om\project\Interceptor.java:[3,25] package javax.serv
let.http does not exist
[ERROR] \Users...\workspace\project\src\main\java\c
om\project\Interceptor.java:[4,25] package javax.serv
let.http does not exist
[ERROR] \Users...\workspace\project\src\main\java\c
om\project\Interceptor.java:[26,26] cannot find symbo
l
......
[ERROR] symbol  : variable HttpServletResponse
[ERROR] location: class com.project.Interceptor
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on
 project mobile-gateway: Compilation failure
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation fail
ure
        at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompiler
Mojo.java:656)
        at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
        ... 19 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureExc
eption

EDIT 2 : By the way, I'm using Eclipse Indigo IDE and Glassfish 3.1.

like image 621
iamtheexp01 Avatar asked Sep 13 '25 06:09

iamtheexp01


1 Answers

You are missing some Java EE dependencies, try adding the following dependency to your pom.xml (you probably need more):

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>servlet-api</artifactId>
  <version>2.4</version>
</dependency>

Hope that helps.

like image 71
yorkw Avatar answered Sep 20 '25 07:09

yorkw