This is a really simple question, and it\'s probably a setting somewhere I don\'t know about, but Google is being particularly unhelpful for this question, giving results ab
SOLUTION: @Before building your component (using mvn clean install). Build the entire project once and build your component again
WHY SO :
I get this error many times.
Most of the times I will try to build my component alone (As I have not made changes elsewhere).
Right, But that extra jar which has been downloaded recently might have affected by changes done by a third party(inside their component). Making a full mvn clean install on entire project saved me many times
In my case the problem was in a child jar which was not rebuilt since I have added a new class, pom.xml of that child jar was not related to my failed pom.xml as child-to-parent relation (using <parent>
tag). So I rebuilt the child jar after which the error had gone.
This is not a function of Maven; it's a function of the compiler. Look closely; the information you're looking for is most likely in the following line.
update to 3.1 :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
In my case, I was using a dependency scoped as <scope>test</scope>
. This made the class available at development time but, by at compile time, I got this message.
Turn the class scope for <scope>provided</scope>
solved the problem.
Generally, this error will appear when your compile code's version is different from your written code's. For example, write code that rely on xxx-1.0.0.jar that one class has method A, but the method changed to B in xxx-1.1.0.jar. If you compile code with xxx-1.1.0.jar, you will see the error.