In this blog post, I want to share useful tips and tricks for developing Java applications in SAP Business Application Studio (BAS).
BAS helps you develop your applications in a quick and easy manner. The development environment is tailored to the type of application you want to create. This means that if you are subscribed to BAS, you do not need to make any further installations or configurations to create Java applications, you simply need to create a dev space of type Full Stack Cloud Application . You can learn more about this process in the Build a Business Application Using CAP for Java tutorial.
So let’s go over a few more tips:
Add Extensions to your Dev Space
Increase the power of SAP Business Application Studio through extensions.
You can install VS Code extensions from the Open VSX Registry to get additional tools to support the development activities in your dev space.
To install an extension, from the left side menu, click (Extensions) or select View > Extensions from the menu bar. You can then browse through the available extensions and click Install when you find the one relevant for you.
For example, let's install “vscode-lombok”. A lightweight extension to support Lombok annotation processing in SAP Business Application Studio
Open the Extensions view and search for “lombo”. You should see extension in the list.
If an extension doesn't provide the functionality you want, you can always uninstall it.
Since BAS is based on Eclipse Theia, some extensions do not work out of the box.
Project Explorer for Java Projects
SAP Business Application studio supports Java project explorer features to interpret folders as “packages” inside the Java project. The functionality is similar to the Project Manager for Java.
From this Java Project View -> you can create new class .
If you change your mind to not to create class just press esc key in text box , to close popup of new class
You can also perform additional actions, such as rename, delete by right clicking on class name
Java Test Explorer
You can also run Junits in SAP Business Application Studio in the Test Explorer view.
Maven Repository in SAP Business Application Studio
You may need a `settings.xml` file in your project to define your Maven repository location.
Note: If your organization does not stores Maven repositories in on-premise systems or internal repositories, there is no need to make any changes as described below (step1 and step2 )
to the default configurations.
If there are Java dependencies coming from internal repositories, you may have to adjust the `settings.xml` file, see “"BTP Sub Account Destination for Maven Repository"
Step1 : BTP Sub Account Destination for Maven Repository
Setting up the destination is actually a prerequisite to using the internal Maven repositories.
Generally, this step is performed once per subaccount by the sub account administrator.
Configure a destination on the subaccount level pointing to the repositories.
You may also need to configure the Cloud Connector, adding it to the allowlist if the Maven repositories are located in an on-premise system.
The Cloud Connector should expose the “nexus /artifactor ” system with the HTTP protocol.