简体   繁体   中英

Eclipse Maven multi module project

i have a multi module project which is consist of a web application and a generated jar project from a wsdl. My development enviroment is eclipse and i want to use this projects both with maven and eclipse. When i build those projects with maven install war project sees its jar dependency but whenever i clean war project and eclipse tries to builds itself it can't resolve the required jar dependency project. Whenever i set jar dependency as optional for war project eclipse resolves it when i clean the war project but this time i can't see the required jar project in the generated war file when i generate it with maven install.

Thanks for any help any idea

i finally found out what is wrong. I set maven builder plugin to use jdk 1.6's rt.jar but my eclipse were opening with jdk 1.5 and it was taking this error. when i configured my eclipse to open with jdk 1.6 everything worked fine. And one more thing that i was using internal maven if you use external maven you may need to change your mvn.bat to use the correct jdk.

Thanks for your help.

Try uninstalling the optional Maven Integration for WTP Ignore the note in the link about deleting from the plugins directory. It's simpler to uninstall from the plugin details screen. Prior to doing this, I had numerous problems in my web-app projects resolving their dependencies within the workspace.

You should also verify that your generated sources project is using the maven eclipse plugin in its pom in order to contribute its generated code to its classpath. See the snippet below. I've found this helps avoid having to configure the classpath manually for projects with generated code. The directories you specify there will be added to the classpath when you select Maven / Update Project Configuration from the project's context menu.

For example:

<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-eclipse-plugin</artifactId>
  <version>2.8</version>
  <configuration>
    <sourceIncludes>
      <sourceInclude>${project.build.directory}/generated-sources/jaxb</sourceInclude>
    </sourceIncludes>
  </configuration>
</plugin>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM