有一个应用程序正常运行,但它不是一个maven项目。每个图书馆都是通过手工添加来管理的。因此,在Spring Tool Suite中,我右键单击Configure>>转换为Maven。然后我更新了POM,如下所示,我的IDE中没有错误。另外,我可以成功构建项目,我可以在webinf / classes中看到类文件。但是,我得到了#34; Context Root Not Found"在浏览器中尝试访问应用程序时,我在EAR或WAR&#34中将其部署到服务器时看到警告;无法启动应用程序应用程序,因为它无法在位置应用程序中找到"。
由于所有关于图书馆的抱怨都是通过POM修复的,所以我完全会对原因感到困惑。我注意到的唯一不同之处是,在Java Build Path中,在我将Project转换为Maven之前,当我点击WebSphere Application Server V8.5 Liberty Profile时,有几个库。现在,在将项目转为Maven后,当我点击它时,没有库。我重新安装了服务器,创建了一个新的配置文件并将其关联到构建路径以防万一它可能是问题但我在单击WebSphere Application Server V8.5 Liberty Profile时仍然没有找到任何库。我是否必须在POM中添加IBM的依赖项?是否有任何步骤将旧项目转换为Maven?我搜索了很多,我看到的所有建议都与在POM中添加依赖关系有关,如下所示,但是如果有特殊的dependendy,我必须添加为WebSphere的原因我不知道。
<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>app</groupId>
<artifactId>app </artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>App Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<spring.version>3.0.5.RELEASE</spring.version>
<java-version>1.6</java-version>
<org.aspectj-version>1.7.4</org.aspectj-version>
<org.slf4j-version>1.7.5</org.slf4j-version>
<jackson.databind-version>2.2.3</jackson.databind-version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.12</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
Spring Tool Suite控制台:
[AUDIT ] CWWKG0017I: The server configuration was successfully updated in 0.488 seconds.
[WARNING ] CWWKZ0014W: The application app_original could not be started as it could not be found at location app.war.
[AUDIT ] CWWKT0016I: Web application available (default_host): http://...:8080/app_original/
[AUDIT ] CWWKZ0001I: Application app_original started in 2.565 seconds.
[WARNING ] Cannot search for matching files underneath URL [bundleresource://100.fwk4347180/] because it does not correspond to a directory in the file system
URL [bundleresource://100.fwk4347180/] cannot be resolved to absolute file path because it does not reside in the file system: bundleresource://100.fwk4347180/
[WARNING ] Cannot search for matching files underneath URL [bundleresource://99.fwk4347180/] because it does not correspond to a directory in the file system
URL [bundleresource://99.fwk4347180/] cannot be resolved to absolute file path because it does not reside in the file system: bundleresource://99.fwk4347180/
[WARNING ] Skipping [C:\STS\ws\app_original\WebContent\WEB-INF\lib\db2java.jar] because it does not denote a directory
[WARNING ] Skipping [C:\STS\ws\app_original\WebContent\WEB-INF\lib\jeapCore-03.02.1.2.jar] because it does not denote a directory
[WARNING ] Skipping [C:\STS\ws\app_original\WebContent\WEB-INF\lib\upload.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\apache\httpcomponents\httpclient\4.1.1\httpclient-4.1.1.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\apache\httpcomponents\httpcore\4.1\httpcore-4.1.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\commons-codec\commons-codec\1.4\commons-codec-1.4.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\codehaus\jackson\jackson-mapper-asl\1.9.12\jackson-mapper-asl-1.9.12.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\codehaus\jackson\jackson-core-asl\1.9.12\jackson-core-asl-1.9.12.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\springframework\spring-core\3.0.5.RELEASE\spring-core-3.0.5.RELEASE.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\springframework\spring-asm\3.0.5.RELEASE\spring-asm-3.0.5.RELEASE.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\springframework\spring-web\3.0.5.RELEASE\spring-web-3.0.5.RELEASE.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\springframework\spring-beans\3.0.5.RELEASE\spring-beans-3.0.5.RELEASE.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\springframework\spring-webmvc\3.0.5.RELEASE\spring-webmvc-3.0.5.RELEASE.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\springframework\spring-context-support\3.0.5.RELEASE\spring-context-support-3.0.5.RELEASE.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\springframework\spring-expression\3.0.5.RELEASE\spring-expression-3.0.5.RELEASE.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\springframework\spring-context\3.0.5.RELEASE\spring-context-3.0.5.RELEASE.jar] because it does not denote a directory
[WARNING ] Skipping [C:\Users\e049447\.m2\repository\org\springframework\spring-aop\3.0.5.RELEASE\spring-aop-3.0.5.RELEASE.jar] because it does not denote a directory