6

Java Development in SAP Business Application Studio (BAS)

 2 years ago
source link: https://blogs.sap.com/2022/05/05/java-development-in-sap-business-application-studio-bas/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
May 5, 2022 3 minute read

Java Development in SAP Business Application Studio (BAS)

0 2 110

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.

BAS1.png

If an extension doesn’t provide the functionality you want, you can always uninstall it.

BAS2.png

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.

BAS3.png

Java Test Explorer

You can also run Junits in SAP Business Application Studio the Test Explorer view.

BAS4.png

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.

BAS5.png

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.

I hope you find these tips useful. Happy coding!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK