2

I want to create a web application project in Eclipse with Maven. Everytime I try to create the project I get an error as "Could not resolve archetype org.apache.maven.archetypes:maven-archetype-webapp:RELEASE from any of the configured repositories".

I have checked for solutions presented in other questions tried them, but none of them solved the issue. I have also changed my settings.xml file to point it to proxy even that didn't help. I also tried deleting the repositries folder in .m2.

Please suggest some solutions for this

Mysterion
  • 9,050
  • 3
  • 30
  • 52
sheetal
  • 189
  • 2
  • 5
  • 16
  • Have a look : http://crunchify.com/how-to-create-dynamic-web-project-using-maven-in-eclipse/ – CodeWalker Jan 27 '15 at 10:33
  • I am creating the project as described in the above link. But I get the above error – sheetal Jan 27 '15 at 10:55
  • What about this : http://stackoverflow.com/questions/25760961/cannot-create-maven-project-in-eclipse/25807975#25807975 ? – CodeWalker Jan 27 '15 at 10:59
  • The solutions mentioned in that question also didn't help – sheetal Jan 27 '15 at 11:22
  • Open `Window > Preferences Open Maven > Archetypes Click 'Add Remote Catalog' and add the following: Catalog File: http://repo1.maven.org/maven2/archetype-catalog.xml Description: maven catalog` – CodeWalker Jan 27 '15 at 11:27

3 Answers3

1
  1. Open Window > Preferences
  2. Open Maven > Archetypes
  3. Click 'Add Remote Catalog' and add the following:
Mahender Yadav
  • 344
  • 1
  • 5
0

That is quite a weird issue ... however m2eclipse gave me my fair share of problems when I tried to create my projects. In fact, I ended up creating the archetypes myself!

Let me share my maven 3 POM file:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.example</groupId>
  <artifactId>example-project</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <dependencies>
        <!-- add your dependencies here -->
  </dependencies>

  <build>
    <finalName>example-project</finalName>
    <pluginManagement>
        <plugins>

            <!-- v. useful! m2eclipse sometimes fails to see it as a 
                 dynamic web app project in Eclipse. Declaring this plugin 
                 would help eclipse recognize its nature (i.e. a Java 
                 project requesting at least JDK1.7+ -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

        </plugins>
    </pluginManagement>
  </build>
</project>

Running mvn eclipse:eclipse on this project should work. You can safely import to eclipse as a maven project as well (File > Import > Existing Maven Projects) If it doesn't, then you should consider re-installing a fresh copy of maven.

Let me know if you manage to get it up and running. :)

Matthew Cachia
  • 4,474
  • 1
  • 13
  • 17
0

I was recently struggling to create a new Maven project in Eclipse. Trying to create a Dynamic Web Project first and then converting it into a Maven project did not work (none of the Java integration was working and my code wouldn't even compile)!

The following article describes how to create a Maven project in Eclipse. The tutorial recommends skipping the archetype part, which might solve the issue described in the original question:

https://www.tech-recipes.com/rx/39279/create-a-new-maven-project-in-eclipse/

If that doesn't work for you, perhaps doing a clean install with the latest version of Eclipse, in a new directory, may help. What you described might just be a bug in Eclipse or one of its installed plugins.

Jonathan Benn
  • 2,908
  • 4
  • 24
  • 28