0

I have one spring project which is running and working fine, but the pom.xml is showing a red color error sign as shown in attached image. image of project hierarchy

I am not able to understand why it is showing this error, even my project is running and working fine. Please suggest how to remove this red tag from project hierarchy.

Thanks in advance

POM.XML

<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>TAS_EMS</groupId>
<artifactId>TAS_EMS</artifactId>
<version>0.0.2</version>
<packaging>jar</packaging>
<name>TAS_EMS</name>
<description>TAS_EMS</description>
<organization>
    <name>TATA POWER SED</name>
    <url>http://www.tatapowersed.com</url>
</organization>
<properties>
    <!-- Spring -->
    <spring-framework.version>4.1.6.RELEASE</spring-framework.version>
    <springboot-framework.version>1.2.3.RELEASE</springboot-framework.version>
    <!-- SqLite -->
    <sqlite.version>3.7.2</sqlite.version>
    <!-- Hibernate / JPA -->
    <hibernate.version>4.2.1.Final</hibernate.version>
    <!-- JSON -->
    <jackson.version>2.5.2</jackson.version>
    <!-- Portlet /JSON RPC -->
    <portlet.version>2.0</portlet.version>
    <!--HTTP / JSONRPC -->
    <commons-codec.version>1.9</commons-codec.version>
    <httpcore.version>4.3.3</httpcore.version>
    <!-- REST XML Mapping -->
    <jaxb.version>2.2.12</jaxb.version>

</properties>

<dependencies>

    <!-- Spring Jetty -->

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>${springboot-framework.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jetty</artifactId>
        <version>${springboot-framework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring-framework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>${springboot-framework.version}</version>
        <scope>test</scope>
    </dependency>

    <!-- Spring JDBC -->

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>${spring-framework.version}</version>
    </dependency>

    <!-- Spring -->

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring-framework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring-framework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${spring-framework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>${spring-framework.version}</version>
    </dependency>

    <!-- Hibernate -->

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>${hibernate.version}</version>
    </dependency>

    <!-- Log4J -->

    <!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> 
        <version>1.7.12</version> </dependency> -->

    <!-- SQLite database JDBC -->

    <dependency>
        <groupId>org.xerial</groupId>
        <artifactId>sqlite-jdbc</artifactId>
        <version>${sqlite.version}</version>
    </dependency>

    <!-- json dependencies + -->

    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>${jackson.version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>${jackson.version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>${jackson.version}</version>
        <optional>true</optional>
    </dependency>

    <!-- | servlet\portlet dependencies + -->
    <dependency>
        <groupId>javax.portlet</groupId>
        <artifactId>portlet-api</artifactId>
        <version>${portlet.version}</version>
        <optional>true</optional>
        <scope>provided</scope>
    </dependency>



    <!-- | Rest XML Mapping + -->

    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
        <version>${jaxb.version}</version>
    </dependency>

    <!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> 
        <version>1.2.3.RELEASE</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> 
        <artifactId>spring-boot-actuator</artifactId> <version>1.2.3.RELEASE</version> 
        </dependency> -->
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-cypher-compiler-2.1</artifactId>
        <version>2.1.5</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-solr</artifactId>
        <version>1.2.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>commons-httpclient</groupId>
        <artifactId>commons-httpclient</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>
            spring-boot-starter-data-elasticsearch
        </artifactId>
        <version>1.2.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-client</artifactId>
        <version>5.10.1</version>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>




        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>false</downloadJavadocs>
            </configuration>
        </plugin>


        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>


        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>

                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <mainClass>com.tpcsed.tasems.app.service.StartApp</mainClass>
                        <classpathPrefix>dependency-jars/</classpathPrefix>
                    </manifest>
                </archive>
            </configuration>
        </plugin>


        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.5.1</version>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <includeScope>runtime</includeScope>
                        <outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>


    </plugins>
</build>

Ajay Yadav
  • 31
  • 1
  • 1
  • 7

5 Answers5

3

I got the same error as mentioned above. To resolve the error i simply change the packaging type of the application from JAR to WAR.

This resolve the error. Make sure to update the project after changing the configuration.

Here is my pom file

<?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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.5.RELEASE</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.shubhasish.boot.practice</groupId>
    <artifactId>spring-boot-practice</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>spring-boot-practice</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-devtools -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>
2

Add below lines in your pom.xml in section:

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-jar-plugin</artifactId>
 <version>3.1.1</version>
</plugin>

Then update the project from maven by right click on Project folder -> Maven -> Update Project

Done!!

Reference: https://github.com/sarl/sarl/issues/921#issuecomment-503858707

1

eclipse is sometimes error with no reason, please try to select all->copy->delete and then paste content and save, it might help.

0

Could you post the pom.xml and show the error that Eclipse throws?

Eclipse does this sometimes.

You can try different things:

1) If you can, disable validation: go to Window->Preferences choose "Validation" in the left Menu (it's right below "Terminal"). Click "Disable all" then "Apply" 2) run a maven configuration with the Goals "clean package" 3) restart Eclipse

If you see no errors in your source code that means that all your dependencies where imported successfully

DavideS
  • 41
  • 5
  • David@ First of all I am using spring tool suit and the sts is not throwing any error. My application is working & running fine , but from yesterday I am getting a red color error tag in project hierarchy (you can find the link of attached image above). – Ajay Yadav May 11 '16 at 09:10
  • Could post a picture of the pom.xml itself? if you hover your cursor on the red line what does it say? – DavideS May 11 '16 at 09:30
  • Davil@ Please find the edited pom.xml, and I am not geeting any error or anything while hovering cursor on the pom.xml. There is no red line inside pom.xml only the file name icon is showing a red tag (find the same in attached llink of image). – Ajay Yadav May 11 '16 at 09:55
0

Refer to these solutions for your erroneous scenario which are answered here.

Aniket
  • 303
  • 5
  • 11