java - Maven project compiles but there are missing imports in the workspace -


i'm using eclipse kepler m2e plugin , want modify maven project , compile it. first converted maven project configure -> convert maven project, there still many missing imports. when use run as... -> maven install project compiles.

how can fix missing imports?

tell m2e update project: context menu of project / maven / update project...

m2e read pom again , update classpath , build project again.

make sure have in .classpath file:

<classpathentry kind="con" path="org.eclipse.m2e.maven2_classpath_container">     <attributes>         <attribute name="maven.pomderived" value="true"/>     </attributes> </classpathentry> 

note: actual syntax might different depending on m2e version use.

another common pitfall scope provided:

provided
compile, indicates expect jdk or container provide dependency @ runtime. example, when building web application java enterprise edition, set dependency on servlet api , related java ee apis scope provided because web container provides classes. scope available on compilation , test classpath, , not transitive.

note last part: not transitive

this means depend on pom says "i need x:y:z, scope provided". project see dependency won't on classpath @ all.

to fix this, copy dependency project same scope (provided).


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -