neblaz
neblaz

Reputation: 733

Spring Boot project (Maven) with AXL - NetBeans cannot find generated AXL packages/classes

A Spring Boot project (Maven) using AXL (Schema 12.5), I use NetBeans 12 as development environment.

I can build the project, it builds successful, the target-forder containts the generated AXL classes, etc., but NetBeans still shows errors in the editor, for example on all those import-statements on the AXL classes like

import com.cisco.axl.api._12.RLine;

The errors are, for example:

package com.cisco.alx.api._12 does not exist

All appearances of usage of AXL artifacts are marked as errors, like:

cannot find symbol
symbol: RLine

Why is that problem in the editor? How to configure?

Because of the errors I cannot use the auto-completion, there are no suggestions on what methods are available, etc.

The target-folder is structured like this:

- target
  ...
  - generated
    - cxf (below this start the packages: com.cisco.axl...)
  ...

Upvotes: 1

Views: 148

Answers (2)

neblaz
neblaz

Reputation: 733

The solution is, or at least a solution, to modify the pom.xml file, like so:

...
<build>
    <resources>
       ...
        <resource>
            <directory>target/generated/cxf</directory>
                <includes>
                    <include>**/*.java</include>
                </includes>
        </resource>
    </resources>
</build>
...

Now the import statements of the generated AXL Java classes work, no errors anymore!

Let's go NetBeans, let's go!

Upvotes: 0

David Staudt
David Staudt

Reputation: 386

Guessing you will need to add the AXL generated classes as a reference to your project, i.e. by adding the target folder to the classpath or by whatever mechanism Netbeans uses to reference external libraries.

This project contains several AXL samples and uses Maven, although with Visual Studio code - it may provide some clues and/or helpful best-practices: https://github.com/CiscoDevNet/axl-java-samples

Upvotes: 0

Related Questions