This offer is only addressed to commercial customers including freelancers and entrepreneurs. All prices are exclusive of value added tax (VAT).
  • Share via email
  • Subscribe to blog alert

Setting up the Maven build tool

What you will learn to do

Learn setting up Maven including access to the Bosch.IO maven repository to access artifacts needed for dependency resolution when building Java-based IoT Web Applications using Bosch IoT Suite client libraries or SDKs.

For Java development, there is a lot of open source to reuse. By using the build tools like Maven or Gradle, half the job of taking care of downloading dependencies and managing versions of libraries is taken care of by the tooling. The Bosch IoT Suite team is providing client libraries and examples as Maven dependencies which will help you to quick-start the development of IoT applications.

If you want to learn about Maven in general, we recommend to first have a look at the Maven in 5 Minutes guide.

What you need to do

You will have to

  • Install Maven
  • Adapt the configuration
  • Verify everything works

Download and installing Maven

If Maven is not yet installed,

  1. Download Maven
  2. Follow the installation instructions
  3. Verify your Maven installation works

Verify the installation by opening a command line:

mvn -version

Adapt the configuration

Maven has a settings file which lists the URLs of the external Maven repositories from which dependencies are downloaded. The default settings.xml is located in the Maven conf/ folder beneath the installation folder. You may want to copy that settings.xml file to your user home into ‘~/.m2/’ to customize it. The settings.xml in your user home will take precedence.

For the resolution of the Bosch IoT Suite libraries, you need to add a new repository. It is recommended to do this by adding a new profile, so that you can easy switch between using and not using repository.

The URL for the Bosch IoT Suite repository is

https://maven.bosch-si.com/content/groups/bosch-releases/

To add this, open the settings.xml and scroll down to the part.

<profile>
  <id>Bosch-IoT-Suite</id>
  <properties>
    <downloadSources>true</downloadSources>
    <downloadJavadocs>true</downloadJavadocs>
  </properties>
  <repositories>
    <repository>
      <id>bosch-releases</id>
      <url>https://maven.bosch-si.com/content/groups/bosch-releases/</url>
    </repository>
  </repositories>
</profile>

You also need to activate the profile before Maven is using it. To automatically activate the profile for all builds, add it to the ‘activeProfiles’ list:

<activeProfiles>
  <activeProfile>Bosch-IoT-Suite</activeProfile>
</activeProfiles>

In case you are working from an enterprise network, you may have to configure your corporate proxy before the next step.

Verify everything works

Download or clone the example project from GitHub.

Unzip and change directory to the project root folder and run Maven on the command line:

mvn install

You should see a success message at the end of the build.