在Java 11中,JAX-WS已从JDK中删除。它阻止了使用wsimport
在后台使用Maven插件轻松生成JAX-WS类。
我为Maven插件org.codehaus.mojo:jaxws-maven-plugin
使用了以下配置。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<extension>true</extension>
<packageName>tech.myproject.service</packageName>
<wsdlFiles>
<wsdlFile>${basedir}/src/main/resources/wsdl/service.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>/wsdl/service.wsdl</wsdlLocation>
</configuration>
</execution>
</executions>
</plugin>
是否有一种简单的方法来安装wsimport或使用另一个插件捆绑特定于体系结构的wsimport来继续生成WSDL类?
答案 0 :(得分:1)
找到了-https://github.com/mojohaus/jaxws-maven-plugin/issues/54#issuecomment-440597801 我使用了与org.jvnet.jax-ws-commons jaxws-maven-plugin相同的配置。认为它与org.codehaus.mojo相同,但不确定100%。
已通过JDK 11测试。生成所有XSD元素,端口和服务。 您还需要向pom添加一些依赖项。 最低要求:
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.javaee-api</groupId>
<artifactId>javax.jws</artifactId>
<version>3.1.2.2</version>
</dependency>
答案 1 :(得分:1)
新版本的from bs4 import BeautifulSoup
import requests
import csv
def job():
url = 'https://www.cardekho.com/compare/maruti-gypsy-and-maruti-omni.htm'
headers = {'User-Agent': 'Mozilla/65.0'}
response = requests.get(url, headers=headers)
soup = BeautifulSoup(response.content, 'html.parser')
stat_table_1 = soup.find_all('table')
print(len(stat_table_1))
tab_1 = stat_table_1[0]
tab_2 = stat_table_1[1]
tab_3 = stat_table_1[2]
tab_4 = stat_table_1[3]
tab_5 = stat_table_1[4]
rows_tab_1 = tab_1.findAll('tr')
rows_tab_2 = tab_2.findAll('tr')
rows_tab_3 = tab_3.findAll('tr')
rows_tab_4 = tab_4.findAll('tr')
rows_tab_5 = tab_5.findAll('tr')
csv_file_1 = open("D:/CarDekho_Data/maruti/maruti_2/overview.csv", 'wt', encoding="utf-8", newline='')
csv_file_2 = open("D:/CarDekho_Data/maruti/maruti_2/engine.csv", 'wt', encoding="utf-8", newline='')
csv_file_3 = open("D:/CarDekho_Data/maruti/maruti_2/transmission.csv", 'wt', encoding="utf-8", newline='')
csv_file_4 = open("D:/CarDekho_Data/maruti/maruti_2/steering.csv", 'wt', encoding="utf-8", newline='')
csv_file_5 = open("D:/CarDekho_Data/maruti/maruti_2/brake_system.csv", 'wt', encoding="utf-8", newline='')
writer_1 = csv.writer(csv_file_1)
writer_2 = csv.writer(csv_file_2)
writer_3 = csv.writer(csv_file_3)
writer_4 = csv.writer(csv_file_4)
writer_5 = csv.writer(csv_file_5)
try:
for row in rows_tab_1:
csv_row = []
for cell in row.findAll(['td', 'th']):
csv_row.append(cell.get_text())
writer_1.writerow(csv_row)
finally:
csv_file_1.close()
try:
for row in rows_tab_2:
csv_row = []
for cell in row.findAll(['td', 'th']):
csv_row.append(cell.get_text())
writer_2.writerow(csv_row)
finally:
csv_file_2.close()
try:
for row in rows_tab_3:
csv_row = []
for cell in row.findAll(['td', 'th']):
csv_row.append(cell.get_text())
writer_3.writerow(csv_row)
finally:
csv_file_3.close()
try:
for row in rows_tab_4:
csv_row = []
for cell in row.findAll(['td', 'th']):
csv_row.append(cell.get_text())
writer_4.writerow(csv_row)
finally:
csv_file_4.close()
try:
for row in rows_tab_5:
csv_row = []
for cell in row.findAll(['td', 'th']):
csv_row.append(cell.get_text())
writer_5.writerow(csv_row)
finally:
csv_file_5.close()
(link)可以使用以下插件使用Java 11生成Java类:
jaxws-maven-plugin
替代插件也可以是Apache CXF(link)的cxf-codegen-plugin