axis1.4与应用集成(续),解决Arraylist<...>的问题

本文介绍在Axis1.4中使用数组代替列表解决WSDL生成问题的方法,包括手动编写客户端示例代码和配置文件说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

前言:上一篇介绍了手动写客户端的axis1.4的应用实例,那个例子是没有问题的,但细心的同志们会发现,生成的wsdl文件是有问题的,比较刺眼的关键字是 ArrayOf_xsd_anyType 这个表明根本不认识list,而且list里放入的对象也没有在该WSDL文件里描述,这样带来的问题就是如果只根据WSDL文件来生成客户端,比如用axis1.4的wsdl2java命令

D:\develop_tools\axis-1_4\lib>java -cp .;axis.jar;jaxrpc.jar;saaj.jar;wsdl4j-1.5.1.jar;commons-discovery-0.2.jar;commons-logging-1.0.4.jar;log4j-1.2.8
.jar org.apache.axis.wsdl.WSDL2Java http://localhost:8091/bjchannel/services/EsopWBService1?wsdl

示例如上,的话,生成的类明显少了一个,就是list里放入的MenuNodeInterface类,这个在WSDL里根本没有体现

而且奇怪的是假如用list的话,如果添加了list的add方法,比如public void addMenuNodeInterface(MenuNodeInterface obj){list.add(obj);}(伪代码)的话,在生成的WSDL里就会有MenuNodeInterface的体现,但集合还是没有。这个看看AXIS的源码就明白了.

 

关于这个问题,首先参看axis1.4的官方文档user-guide.pdf,这个我在附件里上传上来,查看里面的

1.6.3里的1.6.3.1项,说的很清楚,由于LIST这些集合类和其他语言不通用,所以需要当作CUSTOM类自己做映射在service-config.xml里,那就麻烦了,加入实现类是ArrayList的话,还需要把相应的jar包加进来做映射;

所以后面有一句关键的:The most reliable way to send aggregate objects is to use arrays

有感觉没,对了,就是用[]数组来代替接口里需要的属性和返回值。

废话不说了,上代码

1:返回结果类

package com.asiainfo.boss.channel.channelservices;

import java.io.Serializable;


public class EsopResult1 implements Serializable{

	/**
	 * seriaId
	 */
	private static final long serialVersionUID = -1922115715606536898L;
	
	/**
	 * 0:成功
	   1:失败
	 */
	private Short returnCode=1;
	
	//一般不用语言特定的集合类,统一用数组代替
	//private List<MenuNodeInterface> sysMenuNodeList;
	
	private MenuNodeInterface[] sysMenuNodeList;
	
	private String errorMsg;
	
//	public EsopResult1(){
//		sysMenuNodeList=new ArrayList<MenuNodeInterface>();
//		sysMenuNodeList.add(new MenuNodeInterface());
//		
//	}
//	
	public EsopResult1(){
		sysMenuNodeList=new MenuNodeInterface[]{new MenuNodeInterface()};
		
		
	}

	public Short getReturnCode() {
		return returnCode;
	}

	public void setReturnCode(Short returnCode) {
		this.returnCode = returnCode;
	}

//	public List<MenuNodeInterface> getSysMenuNodeList() {
//		return sysMenuNodeList;
//	}
//
//	public void setSysMenuNodeList(List<MenuNodeInterface> sysMenuNodeList) {
//		this.sysMenuNodeList = sysMenuNodeList;
//	}
	//如果用list的话,还不光需要有list的set和get方法,还必须有addlist的方法,这样生成的wsdl才能包含list里的内容对象
	//不过即使这样,还是会有问题,总之用数组代替就对了
	public MenuNodeInterface[] getSysMenuNodeList() {
		return sysMenuNodeList;
	}

	public void setSysMenuNodeList(MenuNodeInterface[] sysMenuNodeList) {
		this.sysMenuNodeList = sysMenuNodeList;
	}
	

	public String getErrorMsg() {
		return errorMsg;
	}

	public void setErrorMsg(String errorMsg) {
		this.errorMsg = errorMsg;
	}


	
	
	
	
}

 

 

2:手动客户端调用测试类

package com.asiainfo.boss.channel.channelservices;


import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;

import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
import org.apache.axis.encoding.ser.BeanDeserializerFactory;
import org.apache.axis.encoding.ser.BeanSerializerFactory;

public class EsopWBClient1 {
	
	public static void main(String...args){
		getResult();
	}
	public static void getResult(){
		try {   
            String endpoint = "http://localhost:8091/bjchannel/services/EsopWBService1";   
            Long opId = new Long(1009);   
            Long orgId = new Long(1000);   
               
            Service service = new Service();   
            Call call = (Call) service.createCall();   
            QName qn = new QName("urn:EsopWBService1","EsopResult1"); 
            QName qn1 = new QName("urn:EsopWBService1","MenuNodeInterface"); 
            //注册 bean   
            call.registerTypeMapping(EsopResult1.class, qn,    
                    new BeanSerializerFactory(EsopResult1.class, qn),    
                    new BeanDeserializerFactory(EsopResult1.class, qn));  
            call.registerTypeMapping(MenuNodeInterface.class, qn1,    
                    new BeanSerializerFactory(MenuNodeInterface.class, qn1),    
                    new BeanDeserializerFactory(MenuNodeInterface.class, qn1));  
  
            call.setTargetEndpointAddress(new java.net.URL(endpoint));   
            call.setOperationName(new QName("EsopWBService1","qryMenuNodeInfoList"));
//            Object[] sss=new Object[2];
//            sss[0]=i1;
//            sss[1]=i2;
            //EsopResult1 ret = (EsopResult1) call.invoke("qryMenuNodeInfoList",new Object[]{i1,i2});
            //以下两个参数必须加,不然后报数组越界异常,因为源码里的operation为的params需要手动设置
            //invoke只负责往里传递数,不管原来方法参数的初始化,以下两句表明调用的方法需要初始化两个参数
            call.addParameter("opId", XMLType.XSD_LONG, ParameterMode.IN);
            call.addParameter("orgId", XMLType.XSD_LONG, ParameterMode.IN);
            EsopResult1 ret = (EsopResult1) call.invoke(new Object[]{opId,orgId});
            
  
            System.out.println("the operation result following:");   
            System.out.println("ErrorMsg = " + ret.getErrorMsg());   
            System.out.println("ReturnCode = " + ret.getReturnCode());   
//            这是用list做属性的客户端写法,没有问题,问题只会出现在wsdl的生成上,因为手写客户端在前面手动
//            注册了list里的内容对象,所以会取到,但是生成的wsdl里是没有的,所以依赖wsdl的wsdl2java生成的
//            客户端程序就有问题了。
//            System.out.println("MenuNodeList().size() = " + ret.getSysMenuNodeList().size());
//            List<MenuNodeInterface> reList=ret.getSysMenuNodeList();
            
            //以下是数组形式的调用
            System.out.println("MenuNodeList().length = " + ret.getSysMenuNodeList().length);
            MenuNodeInterface[] reList=ret.getSysMenuNodeList();
            
            for(MenuNodeInterface mni : reList){
            	System.out.println("菜单名称:"+mni.getS_Caption());
            }
             
        } catch (Exception e) {   
            e.printStackTrace();   
        }   
    }   
	
}

 

 

 

其他的类参照上一篇文章,没有修改

配置文件也没有任何变化

 

OK,附件是我用wsdl2java生成的客户端类,和自己写的测试调用类,打包上传了,老规矩,代码里的报名和有些配置名字自己修改,我就不去除了

 

参考文章

http://forums.sun.com/thread.jspa?threadID=5405862

http://www.javalobby.org/java/forums/t84343.html

 

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.11.0</version> <configuration> <!-- 原有配置保持不变 --> </configuration> </plugin> <repositories> <repository> <id>central</id> <name>Maven Central</name> <url>https://repo.maven.apache.org/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>aliyun</id> <name>Aliyun Maven</name> <url>https://maven.aliyun.com/repository/public</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> </repositories> 把上面代码整合进下面的代码中 <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>jdwlw</groupId> <artifactId>jdwlw</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>maven Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <repositories> <repository> <id>jitpack.io</id> <url>https://jitpack.io</url> </repository> <!-- 可选的阿里云镜像加速 --> <repository> <id>aliyun</id> <name>Aliyun Maven</name> <url>https://maven.aliyun.com/repository/public</url> <releases> <enabled>true</enabled> </releases> <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>javax.servlet-api</artifactId> <version>3.1.0</version> </dependency> --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>4.1.6.RELEASE</version> </dependency> <!-- https://mvnrepository.com/artifact/org.ksoap2/ksoap2 --> <dependency> <groupId>com.google.code.ksoap2</groupId> <artifactId>ksoap2-j2se-core</artifactId> <version>3.6.2</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>4.1.6.RELEASE</version> </dependency> <!-- <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>4.1.6.RELEASE</version> </dependency> --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>3.2.13.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>3.2.2.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc-portlet</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-websocket</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>quartz</groupId> <artifactId>quartz</artifactId> <version>1.5.2</version> </dependency> <dependency> <groupId>org.apache.ibatis</groupId> <artifactId>ibatis-sqlmap</artifactId> <version>2.3.4.726</version> </dependency> <!-- <dependency>--> <!-- <groupId>com.ibatis</groupId>--> <!-- <artifactId>ibatis2-sqlmap</artifactId>--> <!-- <version>2.1.7.597</version>--> <!-- </dependency>--> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>commons-pool</groupId> <artifactId>commons-pool</artifactId> <version>1.6</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.35</version> </dependency> <dependency> <groupId>com.belerweb</groupId> <artifactId>pinyin4j</artifactId> <version>2.5.0</version> </dependency> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.4.1</version> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.5.0-b01</version> </dependency> <!-- 激光消息推送Starts --> <dependency> <groupId>cn.jpush.api</groupId> <artifactId>jpush-client</artifactId> <version>3.1.3</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>17.0</version> </dependency> <dependency> <groupId>com.squareup.okhttp</groupId> <artifactId>mockwebserver</artifactId> <version>1.5.4</version> <scope>test</scope> </dependency> <!-- 激光消息推送END --> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.11</version> </dependency> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>2.10.0</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> <version>2.1.7</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-net/commons-net --> <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> <version>3.3</version> </dependency> <!-- https://mvnrepository.com/artifact/com.mchange/c3p0 --> <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.2</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.ws.commons.axiom/axiom-api --> <dependency> <groupId>org.apache.ws.commons.axiom</groupId> <artifactId>axiom-api</artifactId> <version>1.2.13</version> </dependency> <!-- https://mvnrepository.com/artifact/dom4j/dom4j --> <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.6.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.axis/axis --> <dependency> <groupId>org.apache.axis</groupId> <artifactId>axis</artifactId> <version>1.4</version> </dependency> <!-- https://mvnrepository.com/artifact/javax.xml.rpc/javax.xml.rpc-api --> <dependency> <groupId>javax.xml.rpc</groupId> <artifactId>javax.xml.rpc-api</artifactId> <version>1.1.1</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2 --> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2</artifactId> <version>1.7.6</version> <type>pom</type> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-adb --> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-adb</artifactId> <version>1.7.6</version> </dependency> <!-- https://mvnrepository.com/artifact/soap/soap --> <dependency> <groupId>soap</groupId> <artifactId>soap</artifactId> <version>2.3</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient --> <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>3.1</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.10.4</version> </dependency> <dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId> <version>1.2.0</version> </dependency> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.7.2</version> </dependency> </dependencies> <build> <finalName>jdwlw</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> <encoding>utf-8</encoding> <compilerArguments> <extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs> </compilerArguments> </configuration> </plugin> </plugins> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build> </project>
最新发布
06-23
<think>我们有两个修改点:1.在<build>的<plugins>中,将maven-compiler-plugin添加版本号3.11.02.在<repositories>中,添加Maven中央仓库(central)并调整阿里云仓库(aliyun)的配置,同时移除jitpack.io(因为之前尝试从jitpack.io下载失败,而且我们更换了依赖,现在使用中央仓库和阿里云仓库应该足够)注意:原pom.xml中已经有一个<repositories>,里面包含了jitpack.io和aliyun。我们要将其替换为新的配置(添加central,保留aliyun,移除jitpack.io)。具体步骤:-替换<repositories>标签内的内容为提供的新的仓库配置。-在<build><plugins>中,为maven-compiler-plugin添加<version>3.11.0</version>。另外,我们已经将ksoap2的依赖更换为:<dependency><groupId>com.google.code.ksoap2</groupId><artifactId>ksoap2-j2se-core</artifactId><version>3.6.2</version></dependency>下面我们将修改后的完整pom.xml给出。</think>### 整合后的完整 POM.xml 文件 我已将您提供的仓库配置和编译器插件配置整合到您的 POM.xml 文件中: ```xml <?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>jdwlw</groupId> <artifactId>jdwlw</artifactId> <version>0极.0.1-SNAPSHOT</version> <packaging>war</packaging> <name>maven Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <!-- 修复后的仓库配置 --> <repositories> <repository> <id>central</id> <name>Maven Central</name> <url>https://repo.maven.apache.org/maven2</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>false</enabled> </snapshots> </repository> <repository> <id>aliyun</id> <name>Aliyun Maven</name> <url>https://maven.aliyun.com/repository/public</url> <releases> <enabled>true</enabled> </极releases> <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.springframework</groupId> <artifactId>spring-webmvc</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-beans</artifactId> <version>4.1.6.RELEASE极</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aop</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>com.google.code.ksoap2</groupId> <artifactId>ksoap2-j2se-core</artifactId> <version>3.6.2</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-orm</artifactId> <version>3.2.13.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context-support</artifactId> <version>3.2.2.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-webmvc-portlet</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-expression</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-aspects</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-websocket</artifactId> <version>4.1.6.RELEASE</version> </dependency> <dependency> <groupId>quartz</groupId> <artifactId>quartz</artifactId> <version>1.5.2</version> </dependency> <dependency> <groupId>org.apache.ibatis</groupId> <artifactId>ibatis-sqlmap</artifactId> <version>2.3.4.726</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>commons-dbcp</groupId> <artifactId>commons-dbcp</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>commons-pool</groupId> <artifactId>commons-pool</artifactId> <version>1.6</version> </dependency> <dependency> <groupId>commons-fileupload</groupId> <artifactId>commons-fileupload</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.35</version> </dependency> <dependency> <groupId>com.belerweb</groupId> <artifactId>pinyin4极j</artifactId> <version>2.5.0</version> </dependency> <dependency> <groupId>jstl</groupId> <artifactId>jstl</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.4.1</version> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.5.0-b01</version> </dependency> <dependency> <groupId>cn.jpush.api</groupId> <artifactId>jpush-client</artifactId> <version>3.1.3</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.5</version> </dependency> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>17.0</version> </dependency> <dependency> <groupId>com.squareup.okhttp</groupId> <artifactId>mockwebserver</artifactId> <version>1.5.4</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.11</version> </dependency> <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>2.10.0</version> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> <version>2.1.7</version> </dependency> <dependency> <groupId>commons-net</groupId> <artifactId>commons-net</artifactId> <version>3.3</version> </dependency> <dependency> <groupId>com.mchange</groupId> <artifactId>c3p0</artifactId> <version>0.9.5.2</version> </dependency> <dependency> <groupId>org.apache.ws.commons.axiom</groupId> <artifactId>axiom-api</artifactId> <version>1.2.13</version> </dependency> <dependency> <groupId>dom4j</groupId> <artifactId>dom4j</artifactId> <version>1.6.1</version> </dependency> <dependency> <groupId>org.apache.axis</groupId> <artifactId>axis</artifactId> <version>1.4</version> </dependency> <dependency> <groupId>javax.xml.rpc</groupId> <artifactId>javax.xml.rpc-api</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2</artifactId> <version>1.7.6</version> <type>pom</type> </dependency> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-adb</artifactId> <version>1.7.6</version> </dependency> <dependency> <groupId>soap</groupId> <artifactId>soap</artifactId> <version>2.3</version> </dependency> <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>3.1</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.9.10.4</version> </dependency> <dependency> <groupId>org.eclipse.paho</groupId> <artifactId>org.eclipse.paho.client.mqttv3</artifactId> <version>1.2.0</version> </dependency> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.7.2</version> </dependency> </dependencies> <build> <finalName>jdwlw</finalName> <plugins> <!-- 修复编译器插件 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.11.0</version> <!-- 添加版本号 --> <configuration> <source>1.8</source> <target>1.8</target> <encoding>utf-8</encoding> <compilerArguments> <extdirs>${project.basedir}/src/main/webapp/WEB-INF/lib</extdirs> </compilerArguments> </configuration> </plugin> </plugins> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources> </build> </project> ``` ### 关键修改说明: 1. **仓库配置更新**: - 添加了 Maven 中央仓库作为主要依赖源 - 保留了阿里云镜像作为备用 - 移除了 JitPack 仓库(不再需要) - 明确设置了仓库的 releases/snapshots 策略 2. **编译器插件修复**: - 添加了版本号 `3.11.0` 解决警告 - 保持 Java 1.8 兼容性 - 保留了原有的编译器参数配置 3. **依赖项更新**: - 使用 `ksoap2-j2se-core:3.6.2` 替代之前不可用的依赖 - 保留了其他所有依赖项不变 ### 验证和使用建议 1. **强制更新依赖**: ```bash mvn clean package -U ``` 2. **如果仍遇到问题**: - 清除本地仓库缓存: ```bash rm -rf ~/.m2/repository/com/google/code/ksoap2/ ``` - 使用依赖树分析: ```bash mvn dependency:tree -Dverbose -Dincludes=com.google.code.ksoap2 ``` 3. **长期维护建议**: - 统一 Spring 版本(目前有多个不同版本) - 升级 Log4j 到 2.x 版本(解决安全漏洞) - 使用 Maven 的 dependencyManagement 管理版本 ### 项目健康检查建议 ```xml <!-- 在 <properties> 中添加 --> <properties> <spring.version>4.3.30.RELEASE</spring.version> <log4j.version>2.17.1</log4j.version> </properties> <!-- 在 <dependencyManagement> 中管理版本 --> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-framework-bom</artifactId> <version>${spring.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-bom</artifactId> <version>${log4j.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> ``` ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值