4

I am working on a coding challenge and imported a maven project(Spring Boot) on STS. But I can't run it because it says Errors exists in required project.

I am attaching the pom.xml and STS project structure. It's same if I try in eclipse as well.

<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.abcd</groupId>
    <artifactId>coding-challenge</artifactId>
    <version>1.0.2</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.3.RELEASE</version>
    </parent>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>hackerrank</id>
                        <phase>none</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>assembly/hackerrank.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <configuration>
                    <trimStackTrace>false</trimStackTrace>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-integration-test-sources</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/it/java</source>
                            </sources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>add-integration-test-resources</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>add-test-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>src/it/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.7</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>

enter image description here

enter image description here

mate00
  • 2,727
  • 5
  • 26
  • 34
J. Doe
  • 81
  • 2
  • 3
  • Please copy the error message(s) from the [_Problems_ view](https://help.eclipse.org/photon/topic/org.eclipse.platform.doc.user/concepts/cprbview.htm) into your question. – howlger Aug 19 '18 at 12:53
  • @howlger I am getting below error there `Archive for required library: 'C:/Users/amar/.m2/repository/org/springframework/spring-webmvc/5.0.7.RELEASE/spring-webmvc-5.0.7.RELEASE.jar' in project 'coding-challenge' cannot be read or is not a valid ZIP file` – J. Doe Aug 19 '18 at 14:47
  • It seems the file is broken. Delete the file `spring-webmvc-5.0.7.RELEASE.jar` (or the whole parent folder `5.0.7.RELEASE`), right-click the project and choose _Maven > Update Project..._. – howlger Aug 19 '18 at 20:15
  • Besides what @howlger said, I also see you are using ombok in the pom. So you probably will need to install lombok support into your IDE. See http://www.vogella.com/tutorials/Lombok/article.html – Kris Aug 20 '18 at 15:28

2 Answers2

2

Try updating the project by - Right click on project -> Maven -> Update project(select force update checkbox )

0

It seems like your dependencies got broken Delete local .m2 repository and update your project ,if still not worked then cross check your project structure.

Pratik
  • 456
  • 4
  • 18