Maven 2 Maven构建未运行

Maven 2 Maven构建未运行,maven-2,Maven 2,我已经为我的项目创建了一个maven版本。该版本是成功的。但是当我将它部署到服务器(apache tomcat 6)上时,它会给出关于jar文件的各种错误。但是这些jar文件在类路径上是可用的。但是当我将这些jar文件保存在服务器的lib目录中时,错误就会得到解决。因此,任何对此有任何想法的人..我在使用maven构建时犯了任何错误 我的pom.xml http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 测试1 测试1 0.0.1-快照 战争

我已经为我的项目创建了一个maven版本。该版本是成功的。但是当我将它部署到服务器(apache tomcat 6)上时,它会给出关于jar文件的各种错误。但是这些jar文件在类路径上是可用的。但是当我将这些jar文件保存在服务器的lib目录中时,错误就会得到解决。因此,任何对此有任何想法的人..我在使用maven构建时犯了任何错误

我的pom.xml

http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 测试1 测试1 0.0.1-快照 战争 测试1 http://maven.apache.org

<properties>
    <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>
<repositories>
    <repository>
        <id>central</id>
        <name>Maven Repository Switchboard</name>
        <layout>default</layout>
        <url>http://repo1.maven.org/maven2</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts-core</artifactId>
        <version>1.3.10</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.json-simple</groupId>
        <artifactId>json-simple</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>commons-dbcp</groupId>
        <artifactId>commons-dbcp</artifactId>
        <version>1.2.2</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.0.1</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.8</version>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.jexcelapi</groupId>
        <artifactId>jxl</artifactId>
        <version>2.6.10</version>
    </dependency>
    <dependency>
        <groupId>org.ow2.orchestra.eclipse.birt</groupId>
        <artifactId>org.ow2.orchestra.eclipse.birt.core</artifactId>
        <version>3.7.0</version>
    </dependency>
    <dependency>
        <groupId>org.ow2.orchestra.eclipse.birt</groupId>
        <artifactId>org.ow2.orchestra.eclipse.birt.report.engine</artifactId>
        <version>3.7.0</version>
    </dependency>
    <dependency>
        <groupId>openforecast</groupId>
        <artifactId>openforecast</artifactId>
        <version>1.0.16</version>
        <scope>system</scope>
        <systemPath>D:/testing/WebContent/WEB-INF/lib/OpenForecast-0.5.0.jar</systemPath>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.7</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-math</artifactId>
        <version>2.0</version>
    </dependency>
    <dependency>
        <groupId>net.sf.jsci</groupId>
        <artifactId>jsci</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>taglibs</groupId>
        <artifactId>standard</artifactId>
        <version>1.1.2</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts-taglib</artifactId>
        <version>1.3.10</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>struts</groupId>
        <artifactId>struts-bean</artifactId>
        <version>1.2.7</version>
        <type>tld</type>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.jtds</groupId>
        <artifactId>jtds</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <properties>
                    <maven.compiler.target>1.6</maven.compiler.target>
                    <maven.compiler.source>1.6</maven.compiler.source>
                </properties>
                <encoding>ISO-8859-1</encoding>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
                <packagingExcludes>D:/Test1/src/main/webapp/WEB-INF/web.xml</packagingExcludes>
            </configuration>
        </plugin>
    </plugins>
</build>

ISO-8859-1
中心的
Maven存储库交换机
违约
http://repo1.maven.org/maven2
假的
朱尼特
朱尼特
3.8.1
测试
javax.servlet
servlet api
2.5
org.apache.struts
支柱核心
1.3.10
com.googlecode.json-simple
简单json
1.1
javax.mail
邮件
1.4
公共dbcp
公共dbcp
1.2.2
公地io
公地io
2.0.1
log4j
log4j
1.2.8
net.sourceforge.jexcelapi
jxl
2.6.10
org.ow2.chestration.eclipse.birt
org.ow2.chestration.eclipse.birt.core
3.7.0
org.ow2.chestration.eclipse.birt
org.ow2.chestration.eclipse.birt.report.engine
3.7.0
开放预测
开放预测
1.0.16
系统
D:/testing/WebContent/WEB-INF/lib/OpenForecast-0.5.0.jar
org.apache.poi
poi
3.7
org.apache.commons
公共数学
2
net.sf.jsci
jsci
1.2
公地收藏
公地收藏
1
塔格利布
标准
1.1.2
运行时
org.apache.struts
struts标记库
1.3.10
运行时
支柱
豆角
1.2.7
tld
运行时
net.sourceforge.jtds
jtds
1.2
公用记录
公用记录
1.1.1
maven编译器插件
1.6
1.6
1.6
1.6
ISO-8859-1
maven战争插件
2.1.1
D:/Test1/src/main/webapp/WEB-INF/WEB.xml

您没有在Tomcat上部署jar:您部署了war文件。 war包含一个WEB-INF/lib文件夹,其中包含您的库

Tomcat根目录下的lib文件夹仅用于所有已部署应用程序之间共享的库。例如,数据库驱动程序

检查Maven依赖项是否不在提供的范围内。
它们应该包含在您的WEB-INF/lib文件夹中。

第一件事是您对servlet api的依赖性:

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>servlet-api</artifactId>
  <version>2.5</version>
</dependency>

javax.servlet
在你的pom中,尤其是像你一样的Maven Central

如果您在pom中定义了以下内容:

<properties>
    <project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
</properties>

ISO-8859-1
不需要像这样配置,因为编码参数默认使用上述属性

 <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
        <properties>
            <maven.compiler.target>1.6</maven.compiler.target>
            <maven.compiler.source>1.6</maven.compiler.source>
        </properties>
        <encoding>ISO-8859-1</encoding>
    </configuration>
</plugin>

。如果您需要排除此类情况,应按以下方式进行:

<plugin>
   <artifactId>maven-war-plugin</artifactId>
   <version>2.2</version>
   <configuration>
     <packagingExcludes>${basedir}/src/main/webapp/WEB-INF/web.xml</packagingExcludes>
   </configuration>
</plugin>

maven战争插件
2.2
${basedir}/src/main/webapp/WEB-INF/WEB.xml

但在这种情况下,我不明白您为什么要排除web.xml,因为它是war文件的一个重要部分。也许您可以详细说明一下。

可能是因为范围设置为提供的
。如果您确切地告诉我们您遇到了哪些JAR问题,并可以向我们显示您的文件的完整依赖项部分POM,我们可能可以帮你解决这个问题。谢谢你的回复我正在分享我的POM.xml我想他是指依赖项jar文件。嗨,khmarbaise谢谢你的回复,因为我是maven的新手,所以我已经做了你指定的更改,但我仍然面临以下例外..org.apache.jasper.JasperException:javax.servlet.ServletException:java.lang.NoClassDefFoundError:无法初始化类org.apache.struts.taglib.html.FormTag org.apache.jasper.servlet.JspServletWrapper.HandleJSPEException(JspServletWrapper.java:500)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:410 org.apache.jasper.servlet.JspServlet.serviceJspFilei没有找到openforecast的maven依赖项,这就是为什么我从system.khmarbaise中添加了它。我应该对所有依赖项使用nexus,还是只对maven存储库中不可用的依赖项使用nexus?嗨,我仍然面临着与前面提到的abo相同的错误ve..maven build仍然没有运行。@user1169095 Nexus完全适用于不在maven central或其他存储库中的依赖项。此外,“build仍然没有运行”是什么意思?错误消息?您可以通过-X和消息发布输出吗?
 <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
</plugin>
 <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
</plugin>
<plugin>
   <artifactId>maven-war-plugin</artifactId>
   <version>2.1.1</version>
   <configuration>
     <packagingExcludes>D:/Test1/src/main/webapp/WEB-INF/web.xml</packagingExcludes>
   </configuration>
</plugin>
<plugin>
   <artifactId>maven-war-plugin</artifactId>
   <version>2.2</version>
   <configuration>
     <packagingExcludes>${basedir}/src/main/webapp/WEB-INF/web.xml</packagingExcludes>
   </configuration>
</plugin>