同配置下Eclipse创建的Maven项目同事无法运行,报jaxws-maven-plugin错误
Hey there, it’s super frustrating when a project runs smoothly on your machine but breaks for a teammate—even with matching JDK, Maven, OS, and Eclipse setups. Let’s walk through the most common fixes for this jaxws-maven-plugin error:
1. Clear Corrupted Maven Plugin Cache
Maven caches plugin artifacts locally, and a corrupted download can cause random failures. Have your teammate:
- Delete the jaxws-maven-plugin directory from their local repo:
~/.m2/repository/org/codehaus/mojo/jaxws-maven-plugin/2.5 - Run
mvn clean install -Uin the project root—the-Uflag forces Maven to refresh dependencies and plugins from remote repositories.
2. Verify JDK’s WSImport Tool Works
Even with JDK 1.8, minor distribution differences (Oracle JDK vs. OpenJDK) or missing components can break wsimport. Ask your teammate to:
- Open a command prompt and run
wsimport -version—if this throws an error, their JDK might be missing JAX-WS tools. - Check that their JDK’s
libdirectory containsjaxws-api.jar,jaxws-rt.jar, and related JARs. If not, they may need to reinstall a full JDK distribution that includes JAX-WS components.
3. Validate WSDL File Paths and Existence
Double-check that your teammate has all required WSDL files in the right place:
- Confirm the
wsdlLocationconfigured in thejaxws-maven-pluginsection of your pom.xml matches the actual file path on their machine. - Ensure no WSDL files were excluded via
.gitignoreor missed during the code pull. - Check for file encoding mismatches (e.g., UTF-8 vs. system default) that could cause parsing errors.
4. Align Maven Mirror Configuration
If your teammate’s settings.xml uses a different Maven mirror than yours, it might serve incomplete or outdated plugin artifacts. Have them:
- Compare their
~/.m2/settings.xmlwith yours to ensure mirror settings are identical. - Temporarily switch to the official Maven Central repo by commenting out custom mirrors, then rerun the build to test.
5. Explicitly Pin JAX-WS Tools Version in the Plugin
Sometimes the plugin pulls in incompatible transitive dependencies. Add an explicit jaxws-tools dependency to lock in a version compatible with JDK 1.8:
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>jaxws-maven-plugin</artifactId> <version>2.5</version> <dependencies> <dependency> <groupId>com.sun.xml.ws</groupId> <artifactId>jaxws-tools</artifactId> <version>2.3.5</version> <scope>runtime</scope> </dependency> </dependencies> <!-- Your existing plugin configuration --> </plugin>
6. Test Build via Command Line (Bypass Eclipse)
Eclipse’s Maven integration can have quirks. Ask your teammate to run the build directly from the terminal:
- Navigate to the project root in a command prompt.
- Execute
mvn clean install.
If this works, the issue is likely with Eclipse—try refreshing the project, updating Eclipse’s Maven plugin, or reimporting the project into Eclipse.
If none of these steps fix the problem, ask your teammate to share the full error stack trace (not just the top-level failure message). More details will help pinpoint the exact root cause.
内容的提问来源于stack exchange,提问作者Johnny Maublanc

