1

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...)
  ...
neblaz
  • 683
  • 10
  • 32

2 Answers2

0

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

David Staudt
  • 361
  • 2
  • 2
  • Yes, somehow I have to configure NetBeans to use the target folder also as source folder. Interestingly, Eclipse does this automatically, nothing extra to configure there, but that is not what I want to use. – neblaz Aug 12 '20 at 07:36
  • I'm finding in VS Code I need to run the command for 'Java:Update Project configuration' (this is using the Language Support for Java extension by Redhat) to get it to 'automatically' pick up the AXL api sources in target/classes. I'll admit I'm not a big Maven guru, so I'm not sure what that command ends up doing at the Maven level, but I assume some sort of dependency check/update/import...perhaps there is a Netbeans equivalent, or some Netbeans function for adding a dependency manually for a folder in your project..? – David Staudt Aug 12 '20 at 15:38
  • https://netbeans.org/kb/73/java/project-setup.html explains a bit, section 'Managing a Project's Classpath', the problem is, I cannot find any Libraries category or node (as seen in the screenshot) in my Maven project in NetBeans 12. Where is it hidden now? How to add a source folder (in this case from within the target folder) in NetBeans 12? – neblaz Aug 13 '20 at 12:00
0

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!

neblaz
  • 683
  • 10
  • 32