我正在开发一个Webservice项目,并且在使Maven构建工作时遇到了问题。实际上插件运行没有任何错误,它正在生成jar但没有源。
我用的是pom。
<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.test.affi</groupId>
<artifactId>tradetracker-ws</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>TradeTracker ws library</name>
<organization>
<name>testorgani</name>
<url>www.testorgani.com</url>
</organization>
<distributionManagement>
<repository>
<id>internal.repos.release</id>
<name>Internal Maven2 Release Repository</name>
<url>file:///Users/User/Dropbox/Public/maven/release</url>
</repository>
<snapshotRepository>
<id>internal.repos.snapshot</id>
<name>Internal Maven2 Snapshot Repository</name>
<url>file:///Users/User/Dropbox/Public/maven/snapshot</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven 2</name>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven2-repository.dev.java.net</id>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
<configuration>
<sourceRoot>${project.build.directory}/generated/tradetracker</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>http://ws.tradetracker.com/soap/affiliate?wsdl</wsdl>
<!-- <wsdl>${basedir}/affiliate_wsdl.xml</wsdl> -->
<bindingFiles>
<bindingFile>${basedir}/src/main/resources/bindings.xml</bindingFile>
</bindingFiles>
</wsdlOption>
</wsdlOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
这是我从maven得到的结果。
Uerss-MBP:test-affi-tradetracker-ws User$ mvn deploy
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building TradeTracker webservices library 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- axistools-maven-plugin:1.4:wsdl2java (default) @ tradetracker-ws ---
[INFO] about to add compile source root
[INFO] Nothing to generate. All WSDL files are up to date.
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tradetracker-ws ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ tradetracker-ws ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ tradetracker-ws ---
[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ tradetracker-ws ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ tradetracker-ws ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ tradetracker-ws ---
[INFO] Building jar: /Users/User/test-affi-tradetracker-ws/target/tradetracker-ws-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ tradetracker-ws ---
[INFO] Installing /Users/User/test-affi-tradetracker-ws/target/tradetracker-ws-0.0.1-SNAPSHOT.jar to /Users/User/.m2/repository/affi/tradetracker-ws/0.0.1-SNAPSHOT/tradetracker-ws-0.0.1-SNAPSHOT.jar
[INFO] Installing /Users/User/test-affi-tradetracker-ws/pom.xml to /Users/User/.m2/repository/affi/tradetracker-ws/0.0.1-SNAPSHOT/tradetracker-ws-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ tradetracker-ws ---
Downloading: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/0.0.1-SNAPSHOT/maven-metadata.xml
Downloaded: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/0.0.1-SNAPSHOT/maven-metadata.xml (790 B at 128.6 KB/sec)
Uploading: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/0.0.1-SNAPSHOT/tradetracker-ws-0.0.1-20150607.151342-15.jar
Uploaded: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/0.0.1-SNAPSHOT/tradetracker-ws-0.0.1-20150607.151342-15.jar (3 KB at 1241.2 KB/sec)
Uploading: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/0.0.1-SNAPSHOT/tradetracker-ws-0.0.1-20150607.151342-15.pom
Uploaded: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/0.0.1-SNAPSHOT/tradetracker-ws-0.0.1-20150607.151342-15.pom (3 KB at 1274.9 KB/sec)
Downloading: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/maven-metadata.xml
Downloaded: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/maven-metadata.xml (297 B at 145.0 KB/sec)
Uploading: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/0.0.1-SNAPSHOT/maven-metadata.xml
Uploaded: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/0.0.1-SNAPSHOT/maven-metadata.xml (790 B)
Uploading: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/maven-metadata.xml
Uploaded: file:///Users/User/Dropbox/Public/maven/snapshot/affi/tradetracker-ws/maven-metadata.xml (297 B)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.704 s
[INFO] Finished at: 2015-06-07T17:13:42+02:00
[INFO] Final Memory: 7M/81M
[INFO] ------------------------------------------------------------------------
我缺少什么?请指出我的光!
答案 0 :(得分:3)
经过数小时尝试所有不同的配置后,我找到了正确的配置。
我在urls标记内移动了WSDL位置。
public class Child : INotifyPropertyChanged
{
private int quantity;
public int Quantity
{
get
{
return quantity;
}
set
{
quantity = value;
OnPropertyChanged("Quantity");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
this.VerifyPropertyName(propertyName);
if (this.PropertyChanged != null)
{
var e = new PropertyChangedEventArgs(propertyName);
this.PropertyChanged(this, e);
}
}
}
public class ParentObject : INotifyPropertyChanged
{
private ObservableCollection<Child> children;
public ObservableCollection<Child> Children
{
get
{
return children;
}
set
{
children = value;
OnPropertyChanged("Children");
}
}
public int TotalQuantity
{
get
{
return Children.Sum(c => c.Quantity);
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
this.VerifyPropertyName(propertyName);
if (this.PropertyChanged != null)
{
var e = new PropertyChangedEventArgs(propertyName);
this.PropertyChanged(this, e);
}
}
}
而不是
<configuration>
<urls>
<url>http://ws.tradetracker.com/soap/affiliate?wsdl</url>
</urls>
</configuration>
这对我有用。