I've feel like I have gone through the proper steps to fix this error, and I've looked at other questions about this in SO and other places, but for some reason I'm still having an issue.
I am trying to set up a project using the Apache JMeter source code.
As an example, the file BeanShellAssertion.java
is in
~/workspace/apache-jmeter-2.9/src/components/org/apache/jmeter/assertions.
My source folder is src/components
. The package declaration in BeanShellAssertion.java
is
package org.apache.jmeter.assertions;
Looking at it, it seems like everything is set up the way it is supposed to be. However, the package declaration is causing an error:
The declared package "org.apache.jmeter.assertions" does not match the
expected package "components.org.apache.jmeter.assertions"
Image is below. What exactly am I doing wrong here?
Go to src folder of the project and copy all the code from it to some temporary location and build the project. And now copy the actual code from temporary location to project src. And run the build again. Problem will be resolved.
It's mandatory that class files reside on the same package or directory as declared in their source file using package keyword, failure to do will result in java.
put your src/components/
to source path
right click > properties > java build path > source > add folder > select
src/components
Once I imported an existing maven project, I right clicked on the src folder and removed it from the build path. This fixed the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With