2014-09-16 3 views
0

Я новичок в eclipse.I начал работать затмение сегодня и далее. Мое требование состоит в том, чтобы создать простой проект maven в eclipse.so я положил свой maven в свой диск c и запустил mvn -version.it, показывая версию, и я предполагаю, что maven установлен.Как создать проект Maven в eclipse

Теперь я пытаюсь выполнить команду ниже в моем cmd. Но она всегда отображает ошибку.

mvn archetype:generate -DgroupId=com.selva -DartifactId=SampleApplication -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 

Ошибка

C:\Users\selva>mvn archetype:generate -DgroupId=com.selva 
rtifactId=SampleApplication -DarchetypeArtifactId=maven-archetype-qui 
tart -DinteractiveMode=false 
[INFO] Scanning for projects... 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/pl 
ns/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.p 
ins:maven-clean-plugin:2.5: Plugin org.apache.maven.plugins:maven-cle 
plugin:2.5 or one of its dependencies could not be resolved: Failed t 
ead artifact descriptor for org.apache.maven.plugins:maven-clean-plug 
jar:2.5 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/pl 
ns/maven-install-plugin/2.4/maven-install-plugin-2.4.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.p 
ins:maven-install-plugin:2.4: Plugin org.apache.maven.plugins:maven-i 
all-plugin:2.4 or one of its dependencies could not be resolved: Fail 
to read artifact descriptor for org.apache.maven.plugins:maven-instal 
lugin:jar:2.4 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/pl 
ns/maven-deploy-plugin/2.7/maven-deploy-plugin-2.7.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.p 
ins:maven-deploy-plugin:2.7: Plugin org.apache.maven.plugins:maven-de 
y-plugin:2.7 or one of its dependencies could not be resolved: Failed 
read artifact descriptor for org.apache.maven.plugins:maven-deploy-p 
in:jar:2.7 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/pl 
ns/maven-site-plugin/3.3/maven-site-plugin-3.3.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.p 
ins:maven-site-plugin:3.3: Plugin org.apache.maven.plugins:maven-site 
ugin:3.3 or one of its dependencies could not be resolved: Failed to 
d artifact descriptor for org.apache.maven.plugins:maven-site-plugin: 
:3.3 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/pl 
ns/maven-antrun-plugin/1.3/maven-antrun-plugin-1.3.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.p 
ins:maven-antrun-plugin:1.3: Plugin org.apache.maven.plugins:maven-an 
n-plugin:1.3 or one of its dependencies could not be resolved: Failed 
read artifact descriptor for org.apache.maven.plugins:maven-antrun-p 
in:jar:1.3 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/pl 
ns/maven-assembly-plugin/2.2-beta-5/maven-assembly-plugin-2.2-beta-5. 

[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.p 
ins:maven-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins 
ven-assembly-plugin:2.2-beta-5 or one of its dependencies could not b 
esolved: Failed to read artifact descriptor for org.apache.maven.plug 
:maven-assembly-plugin:jar:2.2-beta-5 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/pl 
ns/maven-dependency-plugin/2.8/maven-dependency-plugin-2.8.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.p 
ins:maven-dependency-plugin:2.8: Plugin org.apache.maven.plugins:mave 
ependency-plugin:2.8 or one of its dependencies could not be resolved 
ailed to read artifact descriptor for org.apache.maven.plugins:maven- 
endency-plugin:jar:2.8 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/pl 
ns/maven-release-plugin/2.3.2/maven-release-plugin-2.3.2.pom 
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.p 
ins:maven-release-plugin:2.3.2: Plugin org.apache.maven.plugins:maven 
lease-plugin:2.3.2 or one of its dependencies could not be resolved: 
led to read artifact descriptor for org.apache.maven.plugins:maven-re 
se-plugin:jar:2.3.2 
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/pl 
ns/maven-metadata.xml 
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/m 
n-metadata.xml 
[WARNING] Could not transfer metadata org.apache.maven.plugins/maven- 
adata.xml from/to central (https://repo.maven.apache.org/maven2): Con 
t to repo.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] 
led: Connection timed out: connect 
[WARNING] Could not transfer metadata org.codehaus.mojo/maven-metadat 
ml from/to central (https://repo.maven.apache.org/maven2): Connect to 
po.maven.apache.org:443 [repo.maven.apache.org/23.235.47.215] failed: 
nnection timed out: connect 
[WARNING] Failure to transfer org.apache.maven.plugins/maven-metadata 
l from https://repo.maven.apache.org/maven2 was cached in the local r 
sitory, resolution will not be reattempted until the update interval 
central has elapsed or updates are forced. Original error: Could not 
nsfer metadata org.apache.maven.plugins/maven-metadata.xml from/to ce 
al (https://repo.maven.apache.org/maven2): Connect to repo.maven.apac 
org:443 [repo.maven.apache.org/23.235.47.215] failed: Connection time 
ut: connect 
[WARNING] Failure to transfer org.codehaus.mojo/maven-metadata.xml fr 
https://repo.maven.apache.org/maven2 was cached in the local reposito 
resolution will not be reattempted until the update interval of cent 
has elapsed or updates are forced. Original error: Could not transfe 
etadata org.codehaus.mojo/maven-metadata.xml from/to central (https:/ 
po.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [re 
maven.apache.org/23.235.47.215] failed: Connection timed out: connect 
[INFO] -------------------------------------------------------------- 
------- 
[INFO] BUILD FAILURE 
[INFO] -------------------------------------------------------------- 
------- 
[INFO] Total time: 04:07 min 
[INFO] Finished at: 2014-09-16T16:44:58+05:30 
[INFO] Final Memory: 8M/99M 
[INFO] -------------------------------------------------------------- 
------- 
[ERROR] No plugin found for prefix 'archetype' in the current project 
d in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] 
ilable from the repositories [local (C:\Users\uniphore\.m2\repository 
central (https://repo.maven.apache.org/maven2)] -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with 
-e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, 
ease read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoP 
inFoundForPrefixException 
C:\Users\Selva> 

Я хочу создать простой Maven проект в затмении. Любая помощь будет принята с благодарностью!

+0

Duplicated вопрос. Решение для вас: http://stackoverflow.com/a/13640110/3728901 –

+0

@ dovy, приведенная выше ссылка объясняет, как включить maven в eclipse.my вопрос, почему моя команда не выполняет или не строит сбой, а также я использую приведенную выше ссылку для включения maven в мое затмение. – Madhesh

ответ

1

Попробуйте эти шаги.

1) В среде Eclipse выберите «Файл»> «Создать»> «Другое» ..., чтобы вызвать мастер создания проекта.

2) Прокрутите до папки Maven, откройте ее и выберите Maven Project. Затем выберите «Далее».

3) Вы можете выбрать Создать простой проект или отказаться от этой опции. Для целей этого руководства мы выберем простой проект. Это создаст базовый Java-проект с поддержкой Maven. Если вам требуется более сложная настройка, оставьте этот параметр непроверенным, и вы сможете использовать более продвинутые функции настройки проекта Maven. Оставьте другие параметры, как есть, и нажмите «Далее».

4) Теперь вам нужно будет ввести информацию о проекте Maven, который вы создаете. Вы можете посетить документацию Maven для более глубокого изучения координат Maven (http://maven.apache.org/pom.html#Maven_Coordinates). В общем случае идентификатор группы должен соответствовать имени вашей организации, а идентификатор артефакта должен соответствовать имени проекта. Версия зависит от вашего усмотрения, так же как и упаковки и других полей. Если это автономный проект, не имеющий родительских зависимостей, вы можете оставить раздел «Родительский проект» как есть. Заполните соответствующую информацию и нажмите «Готово».

5) Теперь вы заметите, что ваш проект создан. Вы поместите свой Java-код в/src/main/java, ресурсы в/src/main/resources и ваш тестовый код и ресурсы в/src/test/java и/src/test/resources соответственно.

6) Откройте файл pom.xml, чтобы просмотреть структуру, созданную Maven. В этом файле вы можете увидеть информацию, введенную на шаге 4. Вы можете также использовать вкладки внизу окна, чтобы изменить просмотр зависимостей, иерархии зависимостей, эффективного POM и необработанного XML-кода для файла pom в вкладку pom.xml.

Теперь будет создан ваш проект Java с Maven с использованием Eclipse.

Если у вас нет Maven в Eclipse, установите m2e.

+0

не удалось разрешить отображение архетипа в окне предупреждения при завершении клика, а проект не создан – Madhesh

+0

Если я включил создание простого проекта проекта, созданного проектом, но ошибка в файле pom.xml – Madhesh

+0

Какая ошибка вы получаете в файле pom – pravi