13

In the compilation of eclipse source base. I have "An API baseline has not been set ..." error.

enter image description here

I tried to add API Baseline, but I don't know how to make or add it.

What's the API Baseline is for, and how can I add or make one?

enter image description here

enter image description here

Lii
  • 11,553
  • 8
  • 64
  • 88
prosseek
  • 182,215
  • 215
  • 566
  • 871
  • possible duplicate of [What's 'API Baseline' in Eclipse PDT](http://stackoverflow.com/questions/8198661/whats-api-baseline-in-eclipse-pdt) – simo.3792 Aug 05 '14 at 06:18

3 Answers3

8

I try to answer the "What's the API Baseline is for, ..." part of the question.

API Baseline is a concept from PDE Tools / API Tools. They are intended to help you maintain plugins that others can use. They help you create compatible API versions.

The Problem:

  1. You create your plugin and release version 1 to the public.
  2. Millions of people will use your plugin and create their own code that depends on the API of your plugin.
  3. You release version 2 to the public. By mistake you change the API of your plugin.
  4. Millions of people update to the new version and have to adapt their code. Thousands of programs fail. People are sad.

The Solution:

  1. You create your plugin, annotate its API and release version 1 to the public.
  2. Millions of people will use your plugin and create their own code that depends on the API of your plugin.
  3. You declare version 1 of your plugin to be the API-Baseline that your code changes are automatically compared against. Any break in the API is presented to you before you release your plugin or run your tests. You release version 2 without any API changes.
  4. Millions of people can update your plugin in their application, because the new plugin release is binary compatible to the previous one.
  5. You declare version 2 of your plugin ....

Summary

If you develop a plugin just for your personal use and are not interested to maintain a compatible API, you can follow the advices to disable the warnings.

When you develop plugins for a community, e. g. the eclipse plugins themselves, it is essential that you keep API incompatibilities to a minimum. Then you will follow the advice and set the baseline to 4.2 when you develop for 4.3. The API tools will help you make 4.3 an enjoyment for all current 4.2 users.

Please note, that the API Tools are for the developers of the plugins that will be used by others. They are not addressed at the users of those plugins.

Oliver Meyer
  • 413
  • 6
  • 7
3

Quoting from Eclipse site, "An API baseline defines the state you want to compare your development workspace bundles against for the purposes of binary compatibility, bundle version numbers, and @since tags. For example, if you are developing bundles for Eclipse 3.4, you could use Eclipse 3.3 as your baseline."

So basically what this means is that you are building bundles (a Plugin Project, which is either an OSGi bundle or an Eclipse Plugin) that require other bundles (dependency bundles/plugins + OSGi framework (core and compendium API/services)), you specify it through an "API Baseline" which guarantees their (dependencies) existence akin to a "profile" (e.g. a Liberty profile in IBM WAS).

As a workaround, you could avoid setting an API baseline for your workspace through the "Plugin Preferences", setting it to "Warning" or "Ignore". This allows you to compile your Plugin (OSGi) project.

Ref: http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Freference%2Fapi-tooling%2Fpreferences%2Fref-baselines.htm

Gautam
  • 31
  • 1
1

you could also just "ignore" it: http://exploreeclipse.blogspot.ch/2014/01/eclipse-error-api-baseline-has-not-been.html

"Windows > Preferences > Plug-in Development > API Baselines > Options > Missing API baseline Then, change "Error" to "Ignore" in the drop down list."

Keep in mind that ignoring can be the wrong thing to do, depending on the use case:

  • If you have to work on the source and even commit to a project, it's probably not a good idea to ignore the API Baseline.
  • If you import bundles just using them as dependencies, for example through Git (maybe to easier pull new changes, or switching to another branch), you can ignore the API Baseline
flavio.donze
  • 7,432
  • 9
  • 58
  • 91
  • Please justify why ignoring it won't shoot me in the foot – Mr_and_Mrs_D Jun 06 '15 at 16:19
  • Well it depends on how you use the imported bundles. If you are actively working on the source you should probably not just ignore the API Baseline. On the other hand, if you just import some plugins (e.g. from git, easier staying updated or need a specific branch) as dependencies, it is save to do so. – flavio.donze Jun 08 '15 at 07:21