I have a maven project that works perfectly fine locally but after I've pushed it to a remote repository on GitHub and cloned it somewhere else (even to a new location on the same computer), one of the imports does not work because
Cannot resolve symbol 'DefaultMouseManager'
and of course maven install is failing with a lot of compilation errors like this one:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/.../CustomMouseManager2.java:[6,36] cannot find symbol
symbol: class DefaultMouseManager
location: package org.graphstream.ui.view.util
Is there anything I should check that may cause this problem?
Is the problem the class DefaultMouseManager or is it something more general?
Related
I am having a weird issue. I added an interface in a different module, and the IDE compiles fine and everything works fine when I run it on my IDE, but when I do mvn clean install I get an error saying cannot find symbol MyInterface. Here is the log of the mvn clean install:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/path/to/MyClass.java:[5,37] cannot find symbol
symbol: class MyInterface
location: package path.to.where.interface.lives
[INFO] 1 error
[INFO] -------------------------------------------------------------
And the line in MyClass.java where it's complaining about is:
import path.to.where.interface.lives.MyInterface;
And my interface looks like this:
package path.to.where.interface.lives;
public interface MyInterface {
public void method();
}
I even added the dependency to the path.to.where.interface.lives package, in the pom file of where MyClass.java lives, but I am still seeing the issue.
I was able to resolve this issue by running mvn clean install on the entire project first, as I was originally running mvn clean install only on a specific module.
By executing a mvn clean package I see a strange maven output:
[ERROR] /home/user/Desktop/mycompany/myapp/server/src/main/java/com/mycompany/myapp/representation/rest/RestControllerAdvice.java:[8,38] error: cannot find symbol
[ERROR] symbol: class InvalidPropertyValueException
[ERROR] location: package com.mycompany.myapp.exception
So, I searched the row nr. 8 in that class and I found this one
import org.springframework.web.bind.annotation.ExceptionHandler;
But, the line which is referred to InvalidPropertyValueException is 2 rows before:
import com.mycompany.myapp.exception.InvalidPropertyValueException;
And, the strange thing, in the package com.mycompany.myapp.exception I didn't found any class or file named InvalidPropertyValueException. But Eclipse accept it and present me in the option list. And this class don't generate any error or red line.
Try maven->update project this error may go out.
On Project Explorer, right-click on the parent module
select maven, then select Update Project
During using mvn install or mvn compile i got error that maven can not find symbol with different methods and variables in mozilla rhino classes. I made exclusions everywhere where it is possible and said to use 7r5 build for rhino. Also i decompiled jar and got sure that mentioned classes and methods in maven were in that classes. I had pom deps and i couldnt exclude all 3d libraries. So in classpath i saw also path to rhino 6r5 library. I thought that problem was there. So i also decompiled that jar but i saw that methods in the error were also there. My question is how i can debug maven and see what library or class it is using for compiling class. All mozilla rhino libraries which are set in classpath have that methods.
PS: I wanted to mention that mvn eclipse:eclipse works fine and i have no errors in eclipse.
[ERROR] ...path_to_class...:[264,65] cannot find symbol
[ERROR] symbol: method getLength()
[ERROR] location: class org.mozilla.javascript.NativeArray
[ERROR] ...path_to_class...:[288,18] cannot find symbol
[ERROR] symbol: method getWrapFactory()
[ERROR] location: variable cx of type org.mozilla.javascript.Context
[ERROR] ...path_to_class...:[322,49] cannot find symbol
[ERROR] symbol: method getLength()
[ERROR] location: variable array of type org.mozilla.javascript.NativeArray
I'm getting a dependency issue with a jar I'm attempting to use.
I receive the following error
remote: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project sparq: Compilation failure: Compilation failure:
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[3,0] error: package com.github.koraktor.steamcondenser does not exist
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[8,8] error: cannot find symbol
remote: [ERROR] class ServerQuery
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[8,34] error: cannot find symbol
Here is the offending java file.
package helpers;
import com.github.koraktor.steamcondenser.*;
public class ServerQuery {
public static String getPlayers() {
SourceServer server = new SourceServer("66.150.155.152",27015);
server.initialize();
return server.toString();
}
}
I've added the following dependency to my pom.xml
<dependency>
<groupId>com.github.koraktor</groupId>
<artifactId>steam-condenser</artifactId>
<version>1.3.9</version>
</dependency>
I've also added the following action_hook pre_build script
mvn install:install-file -Dfile=./app-root/repo/steam-condenser.jar -DgroupId=com.github.koraktor -DartifactId=steam-condenser -Dversion=1.3.9 -Dpackaging=jar
Here's the GitHub for the project
https://github.com/koraktor/steam-condenser-java
And the website for it
http://koraktor.de/steam-condenser/usage/
Any ideas? Completely lost. Help much appreciated.
Since you are including the jar file in your project already, trying to manage the dependency with Maven seems like overkill. You should be able to put the jar file in your project's lib directory like this article describes. Then you won't need to configure that dependency in Maven at all.
I would use Maven for any dependencies that you want to download at the time your application is being built. Any jar files that you are checking into your project shouldn't need to be configured in Maven.
Just by looking at the question and the excerpts provided, I believe you are struggling with the basics of Maven. If I understand the situation correctly you have a library (which is not written by you):
once added to your project as a Maven dependency. This seems reasonable if you want to use it.
once the source code of the library incorrectly added to your own Java project.
remote: [ERROR] /var/lib/openshift/55846322500446673d000007/app-root/runtime/repo/src/main/java/ServerQuery.java:[3,0] error: package com.github.koraktor.steamcondenser does not exist
Based on the errormessage above it seems you have copied one of the sourcefiles from the library into your project. This is now causing problems. The main one is that without your source-folder (src/main/java) correctly representing the package structure declared in the source file (com.github...) it cannot be compiled. Hence the errormessage:
package com.github.koraktor.steamcondenser does not exist.
First of all you need to remove this copy-pasted file entirely an just use the dependency-management feature of Maven to get the library on classpath. After that just follow the examples given by the author of the library using the link you have already found (http://koraktor.de/steam-condenser/usage/).
I am trying to "Mavenize" our existing Commerce solution. However, I am getting a weird error when I try to run mvn compile I get the following error.
[ERROR] /home/user/tmp/IBM/WCDE_ENT70/workspace/WebSphereCommerceServerExtensionsData/ejbModule/org/ecommerce/wcs/changerequest/ChangeRequestAccessBean.java:[347,32] cannot find symbol
[ERROR] symbol : method createAccessBeans(java.util.Collection)
[ERROR] location: class org.ecommerce.wcs.changerequest.ChangeRequestAccessBean
When I check the class it is related to the com.ibm.ivj.ejb.runtime.AbstractEntityAccessBean class which IBM has neglected to include JavaDoc for anywhere. I look into eclipse and it shows me the method in question was correct using code complete, however, it still fails with maven.
I am wondering if it isn't a customisation to the IBM jre (I am not using that for this POC) and if there is no way around it (short of extending the class and reimplementing).
Anyone?
Problem had to do with multiple imports of different versions of the same dependency. Now this has been resolved.