Skip to Content
Technical Articles
Author's profile photo Showkath Ali Naseem

Java Development in SAP Business Application Studio (BAS)

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

 

  1. Open the Extensions view and search for “lombo”. You should see extension in the list.
  2. Click Install.

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.

 

  1. Configure a destination on the subaccount level pointing to the repositories.

 

  1. 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.

See Cloud Connector.

 

  Step2 :  Update the `settings.xml` File

 

The `settings.xml` file is a standard configuration file for Maven projects.

 

The location this file in your dev spaces in BAS is: “/home/user/.m2/settings.xml”.

 

Open the File > Open menu, and navigate to /home/user/.m2/settings.xml.

Open the file and edit it as needed.

 

Do not replace the existing `settings.xml` in BAS. I suggest instead to recommend on using the term edit  to add more repositories if needed.

 

Build Java application in BAS

 

You can open terminal & navigate to your project folder using “CD” commands just like how you do it in windows/linux shell then execute maven commands

 

 

 

 

You can also find list of Java Commands available in BAS

Go to View Menu –> Type Java -> You may try below commands

 

 

I hope you find these tips useful. Happy coding!

 

 

 

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.