My main class references a Settings.java class, and running maven w/o referencing the new properties it works fine when I do:
mvn assembly:assembly
If I reference a new property, I get this error:
[ERROR] /Users/.../service.java:[41,58] cannot find symbol
[ERROR] symbol : method getDefaultScore()
This is a multi-maven project. The dependency is a local one that is just another maven module, so not sure why it isn’t picking this new property up.
I did run mvn clean at the root just in case things where cached.
Note: This application works fine when I build and run it via IntelliJ, but using maven it doesn’t seem to be liking this new property (which doesn’t is simply a string property that returns a value that I assign, it isn’t reading from a property file or anything).
When running with debug:
mvn assembly:assembly -X
I get the same ‘cannot find symbol’ and the location is my other maven module’s class, and then I get:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project myapp-jobs: 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.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:199)
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.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.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(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 23 more
Just to make sure, I replaced the reference of the new property with a property that is older, and the mvn command ran fine, so it is def. having an issue with the new property, which is simply:
public class Settings {
..
..
private String defaultScore = "100";
public String getDefaultScore() {
return defaultScore;
}
}
My computer/maven versions etc:
- Apache Maven 3.0.3 (r1075438; 2011-02-28 12:31:09-0500)
- Maven home: /Users/../java/apache-maven-3.0.3
- Java version: 1.6.0_31, vendor: Apple Inc.
- Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
- Default locale: en_US, platform encoding: MacRoman
- OS name: “mac os x”, version: “10.7.4”, arch: “x86_64”, family: “mac”
Please make sure that you use the right version of the dependency project where you added the new property. If this project has version 1.0.0-SNAPSHOT (it’s a snapshot version, right?), make sure to reference this version in the project where you want to see the property.
Once the versions have been verified, run a
mvn clean installin the root to rebuild all of your dependencies.If that doesn’t work, please check your local Maven repository (in
~/.m2) to check that the JAR file of the dependency contains the latest version of the class.