Ki-Wi
@Ki-Wi

Почему возникают проблемы с импортом проекта Maven в Eclipse?

Здравствуйте.

При импорте проекта Maven в Eclipse возникает проблема со структурой проекта. Проект создан по архетипу maven-webapp-archetype. Чтобы добавить возможность импотра в Eclipse использовал mvn eclipse:eclipse. В файле .classpath все вроде окей:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
  <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
  <classpathentry kind="output" path="target/classes"/>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/springframework/spring-core/4.2.0.RELEASE/spring-core-4.2.0.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-core/4.2.0.RELEASE/spring-core-4.2.0.RELEASE-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/springframework/spring-web/4.2.0.RELEASE/spring-web-4.2.0.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-web/4.2.0.RELEASE/spring-web-4.2.0.RELEASE-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/springframework/spring-aop/4.2.0.RELEASE/spring-aop-4.2.0.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-aop/4.2.0.RELEASE/spring-aop-4.2.0.RELEASE-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/springframework/spring-beans/4.2.0.RELEASE/spring-beans-4.2.0.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-beans/4.2.0.RELEASE/spring-beans-4.2.0.RELEASE-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/springframework/spring-context/4.2.0.RELEASE/spring-context-4.2.0.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-context/4.2.0.RELEASE/spring-context-4.2.0.RELEASE-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/springframework/spring-expression/4.2.0.RELEASE/spring-expression-4.2.0.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-expression/4.2.0.RELEASE/spring-expression-4.2.0.RELEASE-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/springframework/spring-webmvc/4.2.0.RELEASE/spring-webmvc-4.2.0.RELEASE.jar" sourcepath="M2_REPO/org/springframework/spring-webmvc/4.2.0.RELEASE/spring-webmvc-4.2.0.RELEASE-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar" sourcepath="M2_REPO/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/ch/qos/logback/logback-core/1.0.13/logback-core-1.0.13.jar" sourcepath="M2_REPO/ch/qos/logback/logback-core/1.0.13/logback-core-1.0.13-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.7.5/slf4j-api-1.7.5-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/org/slf4j/jcl-over-slf4j/1.7.5/jcl-over-slf4j-1.7.5.jar" sourcepath="M2_REPO/org/slf4j/jcl-over-slf4j/1.7.5/jcl-over-slf4j-1.7.5-sources.jar"/>
  <classpathentry kind="var" path="M2_REPO/jstl/jstl/1.2/jstl-1.2.jar"/>
</classpath>

Проблема возникает когда хочу добавить новый класс в src/main/java/. Eclipse по какой-то причине распознает его как ресурс, а не исходный код. Через Maven все нормально собираеться и работает.

Удалить и снова импортировать проект уже пытался - не помогло. В чем может быть причина и как это пофиксить? Заранее спасибо.

UPD: Плагин m2e для Eclipse решил проблему: рабоать с проектом в Eclipse таки удалось, но вопрос о maven-eclipse-plugin все еще остаеться открытым.
  • Вопрос задан
  • 720 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы
Bell Integrator Ульяновск
До 400 000 ₽
Bell Integrator Хабаровск
До 400 000 ₽
Bell Integrator Ижевск
До 400 000 ₽