[slf4j-user] SLF4J on the Google Android Platform

Ceki Gulcu ceki at qos.ch
Fri Oct 23 16:17:38 CEST 2009



Thorsten Möller wrote:
> On Thursday, October 22, 2009 7:32 PM [GMT+1=CET],
> Ceki Gulcu <ceki at qos.ch> wrote (with possible deletions):
> 
>>>> module so that it copies the source files it needs from the
>>>> slf4j-api module. This is pretty easy to do with an Ant target
>>>> which you can then add to the Maven build life cycle.  By the way,
>>>> initial versions of SLF4J where each binding also contained the
>>>> contents of slf4j-api used to work exactly this way.
>>> Would be a solution. Let me check that.
> Another question on your proposal: how did you support working with IDEs 
> (such as Eclipse) at that time? I can only imagine that one has to build 
> the project using Maven first (which copies the API files to the binding 
> project) and afterwards imports the project into Eclipse. The question 
> then is how-to consistently deal with updates in the original API 
> project and also how-to deal with a clean build.
> 
> I still prefer referencing required slf4j-api classes from 
> slf4j-android. After one day of working with Git I learned that it has 
> the notion of remotes, submodules, and I also read something about 
> support of file system symlinks. However, I'm still on the way to get 
> the complete picture to see if it is possible.

You would wire the copying of slf4j-api sources into slf4j-android on each 
build. For example, by tying the copy operation to the "generate-sources" phase 
of the maven life cycle. There is an example of such a procedure in 
slf4j/integration/pom.xml. A bunch of tests defined in an Ant script are run 
during the packaging phase of the integration module. These tests define a bunch 
of different class paths in the Ant script which is much harder to do with Maven.

See also http://maven.apache.org/plugins/maven-antrun-plugin/

You could also trigger the copying manually (after defining a Ant script to do 
so as above).

>>> Note that you need to install the Android SDK and set an environment
>>> variable ANDROID_SDK_HOME in order to build it.
>> Why on earth isn't it possible to fetch android jar from the central
>> Maven repo or any other repo? Isn't Android licensed under Apache?

> Probably because Google guys don't care much about Maven... Joking 
> apart, other options would be to install android.jar to the local Maven 
> repos, or to use toolchains [1]. Unfortunately, all of them require some 
> initial setup of the environment; the latter is even not officially 
> released yet.

Adding a manual installation step would be a regression compared to the current 
build. However, we could imagine that while optional for an anonymous build, 
building for a release would require slf4j-android to be build and packaged 
inside SLF4J. (Here I am assuming slf4j-android is shipping with SLF4J proper.)

Alternatively, you could host slf4j-android elsewhere or host it at slf4j.org 
but as a separate project(sub-project). Whenever you are ready to make a release 
you would just copy the contents of slf4j-android project into http://slf4j.org 
without any intervention on my part. I would obviously prefer the latter approach.

> -- Thorsten

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch



More information about the slf4j-user mailing list