2

While I have seen many solutions for this problem (or maybe I should call them workarounds) what causes these files to have to be pushed to an external library. It almost seems random that the occasional project needs to have the jars exported and a few other steps done in order to be able to deploy your project to an external server. I'm included my pom.xml file below. Maybe it's how I set up my pom file.

TIA

<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.websystique.springmvc</groupId>
    <artifactId>SecureRESTApiWithBasicAuthentication</artifactId>
    <version>1.0.0</version>
    <packaging>war</packaging>

    <name>SecureRESTApiWithBasicAuthentication</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <springframework.version>4.3.1.RELEASE</springframework.version>
        <springsecurity.version>4.1.1.RELEASE</springsecurity.version>
        <jackson.library>2.7.5</jackson.library>
    </properties>

    <dependencies>
        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${springframework.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${springframework.version}</version>
        </dependency>

        <!-- Spring Security -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>${springsecurity.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>${springsecurity.version}</version>
        </dependency>

        <!-- Jackson libraries -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>${jackson.library}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-xml</artifactId>
            <version>${jackson.library}</version>
        </dependency>

        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
        </dependency>

        <!-- apache commons codedc -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.10</version>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.2</version>
                    <configuration>
                        <source>1.8</source>
                        <target>1.8</target>
                    </configuration>
                </plugin>           
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.4</version>
                    <configuration>
                        <warSourceDirectory>src/main/webapp</warSourceDirectory>
                        <warName>SecureRESTApiWithBasicAuthentication</warName>
                        <failOnMissingWebXml>false</failOnMissingWebXml>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <finalName>SecureRESTApiWithBasicAuthentication</finalName>
    </build>
</project>

Below are the warnings I'm receiving.

Description Resource    Path    Location    Type
Classpath entry M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.      SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.7.0/jackson-annotations-2.7.0.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.   SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/com/fasterxml/jackson/core/jackson-core/2.7.5/jackson-core-2.7.5.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.     SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.7.5/jackson-databind-2.7.5.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.     SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/com/fasterxml/jackson/dataformat/jackson-dataformat-xml/2.7.5/jackson-dataformat-xml-2.7.5.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.   SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.7.5/jackson-module-jaxb-annotations-2.7.5.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.     SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/commons-codec/commons-codec/1.10/commons-codec-1.10.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.      SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.      SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.    SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/codehaus/woodstox/stax2-api/3.1.4/stax2-api-3.1.4.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.    SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/springframework/security/spring-security-config/4.1.1.RELEASE/spring-security-config-4.1.1.RELEASE.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.   SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/springframework/security/spring-security-core/4.1.1.RELEASE/spring-security-core-4.1.1.RELEASE.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.   SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/springframework/security/spring-security-web/4.1.1.RELEASE/spring-security-web-4.1.1.RELEASE.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.     SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/springframework/spring-aop/4.3.1.RELEASE/spring-aop-4.3.1.RELEASE.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.    SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/springframework/spring-beans/4.3.1.RELEASE/spring-beans-4.3.1.RELEASE.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.    SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/springframework/spring-context/4.3.1.RELEASE/spring-context-4.3.1.RELEASE.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.    SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/springframework/spring-core/4.3.1.RELEASE/spring-core-4.3.1.RELEASE.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.      SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/springframework/spring-expression/4.3.1.RELEASE/spring-expression-4.3.1.RELEASE.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.      SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/springframework/spring-web/4.3.1.RELEASE/spring-web-4.3.1.RELEASE.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.    SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Classpath entry M2_REPO/org/springframework/spring-webmvc/4.3.1.RELEASE/spring-webmvc-4.3.1.RELEASE.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.      SecureRESTApiWithBasicAuthentication        P/SecureRESTApiWithBasicAuthentication  Classpath Dependency Validator Message
Dale
  • 1,613
  • 4
  • 22
  • 42
  • which jars are not being exported? normally there are certains jars which are required at compile time, but the server should be providing for you. such as the servlet API, JDBC drivers, some logging frameworks etc – slipperyseal Mar 28 '17 at 02:23
  • I've added the pom.xml file I use to build my project as well as the warnings I'm receiving in Eclipse (STS). – Dale Mar 28 '17 at 02:25
  • weird. it seems to be eclipse specific behaviour, not an issue with your maven project http://stackoverflow.com/questions/11577380/how-to-set-eclipse-to-ignore-the-classpath-dependency-validator-message-warnin – slipperyseal Mar 28 '17 at 02:35
  • For what it's worth, if this is a new project setup, Spring Boot is nearly always the way to go--jar if at all possible, but a Boot war is better than hand-rolling. – chrylis -cautiouslyoptimistic- Mar 28 '17 at 02:41
  • It definitely has something to do with the validation preferences. I tried to go to that setting and when I click on the menu, STS says that the settings are incorrect and gives me a blank page. – Dale Mar 28 '17 at 02:43
  • 2
    I avoid IDE integrations where possible. They can be handy, but at the end of the day, if the command line build doesn't work, it's not going to work on the CI server either. – slipperyseal Mar 28 '17 at 02:45

1 Answers1

0

What seems to cause this is ultimately an Eclipse problem. More or less a broken Eclipse project preferences and/or an Eclipse older project that is not completely compatible with the current Eclipse project. To get around this I ended up creating another project with the same configuration (in this case Spring MVC) with simply an underscore at the end of the project. Then I started simply copying over the POM files and all of the other files. Once I was done, everything worked great.

Dale
  • 1,613
  • 4
  • 22
  • 42