How do I get Eclipse to resolve classes generated with Maven 2?

前端 未结 9 881
日久生厌
日久生厌 2020-12-12 22:11

I\'m using Google Protocol Buffers to generate some Java classes for my project. Using Maven 2 and its \"antrun\" plugin, these classes are freshly generated before compile,

9条回答
  •  萌比男神i
    2020-12-12 22:24

    I had this issue with code generated using Maven and wsdl2java and here's what I did in Eclipse Juno to resolve it. Assume my project is named project1:

    1. Right-click project1 and select Properties
    2. Choose Java Build Path from the left and select the Libraries tab
    3. Click Add Class Folder
    4. Select the bin directory and click OK (project1/target/generated-sources/bin)
    5. Click OK and Refresh the project

    As an added bonus you can also attach the source code:

    1. Click the arrow next to the new class folder you just created
    2. Click on Source attachment
    3. Click the Edit button
    4. Set the Path to /project1/target/generated-sources/axis2/src
    5. Click OK

提交回复
热议问题