copied
copied

Reputation: 151

Splitting existing gradle dependency into multiple modules

I currently have published library on maven central. The library is android library .aar project. The problem is that current library needs to be split into multiple libraries while maintaining currently published library artifactId for backward compatibility. Here is an example what i have and what i'm trying to achieve.

Current artifactId

compile 'com.example:my-library:1.0.0'

New artifactId

compile 'com.example:my-library-core:1.0.0'
compile 'com.example:my-library-deps-1:1.0.0'
compile 'com.example:my-library-deps-2:1.0.0'

compile 'com.example:my-library:1.0.0' (with deps)
--> compile 'com.example:my-library-core:1.0.0'
--> compile 'com.example:my-library-deps-1:1.0.0'
--> compile 'com.example:my-library-deps-2:1.0.0'

So basically the idea is to keep the original com.example:my-library maven artifactId which will only have dependencies to 3 newly created libraries to support backward compatibility for old customers.

Now i've tried locally to have a pom file without artifact and with dependencies only, but gradle doesn't pull artifacts from dependencies from some reason.

Upvotes: 1

Views: 412

Answers (1)

copied
copied

Reputation: 151

To answer my own question.

The solution is to have a separate module that will have no classes and empty manifest, resulting in empty .aar archive. This will allow you to keep the existing artifact ID with dependencies to new modules.

Upvotes: 1

Related Questions