1

I am getting this error while importing a maven project in eclipse.I tried solution posted at here but didn't get issue resolved.Not sure if pom is real culprit but just adding the code below

<?xml version="1.0" encoding="UTF-8"?>
<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>abc</groupId>
    <artifactId>xyz</artifactId>
    <packaging>jar</packaging>
    <name>Selenium Test</name>

    <build>
        <finalName>selenium</finalName>
        <sourceDirectory>src/main/java</sourceDirectory>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
        </resources>

    </build>

    <dependencies>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.25.0</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>
eis
  • 51,991
  • 13
  • 150
  • 199
sandy
  • 1,153
  • 7
  • 21
  • 39
  • Do you think that you have given enough info here? I don't. – Dave Richardson Oct 26 '12 at 09:49
  • 2
    you are having problems with eclipse, but does it work on running command line then? what is the stack trace? which maven goals are you running? which eclipse maven integration/eclipse version do you have? have you tried using `mvn -X`, what was the output? – eis Oct 26 '12 at 10:20
  • Why don't you use the conventions of Maven (src/main/java is default, src/main/resources is default. Why excluding *.java from src/main/java ? Why don't you define the scope test for selenium as for testng ? – khmarbaise Oct 26 '12 at 13:25
  • Possible duplicate of [An internal error occurred during: "Updating Maven Project". java.lang.NullPointerException](https://stackoverflow.com/questions/19522897/an-internal-error-occurred-during-updating-maven-project-java-lang-nullpoint) – nikodaemus May 25 '17 at 16:26

3 Answers3

0

There may be a spelling mistake with the project 'final name' or other declarations within the pom.xml. You could delete the project from the workspace then import it back. That should at least show some errors in console. You may get this error if you refractored your project name. Somehow, the refractor does not update the references.

Badmash
  • 25
  • 6
0

It simply means that the pom.xml is having error. It could be simple spelling mistake or issue with some dependency. Here is a step wise approach, which may resolve your issue.

Step 1: Take backup of your existing pom.xml.

Step 2: Create a new project POM. You could use the below one as it is

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>samplemaven</artifactId>
  <version>0.0.1-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- Your dependencies goes here. -->
    </dependencies>

</project>

Step 3: Change the groupId, artifatId etc (bare minimum changes required).

Step 4: Delete the .project, .classpath and .settings folder from the project directory (if you have these files are there earlier).

Step 5: import the project in eclipse. You should not find any issue in importing.

Step 6: Once import is completed, change the new pom.xml to introduce other configuration from the old pom.xml (backed up in step 1).

Do not replace the new pom.xml, as it most likely to bring back the original issue. Also be careful while retrofitting the changes to not to re-introduce the issue again.

Gyanendra Dwivedi
  • 5,511
  • 2
  • 27
  • 53
-1

I had the same error, i replace all the variables like in artifact and in version to the expected value and then the project imported perfectly, then i return back all the variables

4EACH
  • 2,132
  • 4
  • 20
  • 28