Reputation: 37034
I faced with foggy issue.
I am novice in project. I use Eclipse. all my colleagues use IDEA. I have checkout project from svn.
I performed corresponding maven tasks for building and deploying project. all works good.
But my Eclipse shows me problem.
in code:
sceneService.uploadFile(...);
eclipse shows that sceneService
hasn't uploadFile
method
I began researching. I show this class on PC of my colleague. But there aren't this issue. I noticed that we use different version of jar file of sceneService
class.
We use same revision of the pom.xml.
dependency for jar in my pom.xml(for my module):
<dependency>
<groupId>com.day.cq.dam</groupId>
<artifactId>cq-dam-scene7</artifactId>
<scope>provided</scope>
</dependency>
when I type alt+shift+w
I see that jar contains sceneService
class takes from another module.
Upvotes: 0
Views: 2645
Reputation: 389
I am facing a similar issue, I have two Maven projects in workspace. Main Project is using output JAR of a Helper project as an artifact.
Now the problem is that Main project is trying to Reference JUnit library of Helper project (which has older version 4.10) instead of it's own JUnit library having version 4.12. Because of this in-correct referencing I get build errors in main project.
Only work around which I found is to close the Helper project and have only Main project open in workspace.
Possibly this is an Eclipse bug.
Upvotes: 1
Reputation: 69339
I think my earlier comments about the "provided" scope are a red herring. The actual problem is likely due to conflicting versions.
By default, Eclipse enables workspace resolution of artifacts. This means it will find artifacts to use (i.e. cq-dam-scene7
) from other projects in your workspace. It will also find them in the .m2
repository as well; I'm not sure which takes precedence.
Possible routes towards a solution include:
Specify a version for your artifact. This will ensure you use the correct JAR, even if it has to be found in the local .m2
repository.
<dependency>
<groupId>com.day.cq.dam</groupId>
<artifactId>cq-dam-scene7</artifactId>
<version>1.2.3</version>
<scope>provided</scope>
</dependency>
Ensure your local cq-dam-scene7
project contains the correct code - i.e. a version with the uploadFile()
method defined.
Upvotes: 2
Reputation: 21
Delete the repository folder in .m2 (in your user dir) and let maven rebuild it in next build cycle. It will ensure no old jars are cached locally
Upvotes: 0
Reputation: 531
I think there is some issue in downloading the correct jar by Maven. your local repository may contain an earlier version of the jar.
Try these commands by going to the root folder of your project from command prompt.
if still the problem persists try deleting your local .m2 repository and again rebuilding the project
Upvotes: 4