Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven Central #164

Closed
paulovap opened this issue Aug 29, 2013 · 57 comments
Closed

Maven Central #164

paulovap opened this issue Aug 29, 2013 · 57 comments

Comments

@paulovap
Copy link

StickyListHeaders on Maven Central would be nice!

@emilsjolander
Copy link
Owner

yes it would. I have just not had time to look into how to publish it there ;/

@ChristianKatzmann
Copy link
Contributor

Please consider publishing the library as a jar (and not as an aar) since the library does not require Android resources and it's R file.

@emilsjolander
Copy link
Owner

The library actually does require resources as of the last release so i will look into publishing an aar. Any help publishing it would be appreciated. Never done it before and really have no idea where to start.

@ChristianKatzmann
Copy link
Contributor

Ah, right, forgot about the new attrs.xml. Maybe you could take a look at Chris Banes' article about publishing AARs to Maven central: http://chris.banes.me/blog/2013/08/27/pushing-aars-to-maven-central/

@emilsjolander
Copy link
Owner

Yeah i read that post, still no totally certain on what to do as that mostly is targeted at gradle builds from the look of it

@ChristianKatzmann
Copy link
Contributor

Yeah, then why not change the build system from Maven (pom.xml) to Gradle (build.gradle)? I think it's nearly impossible to upload an aar with a pom.xml..

@emilsjolander
Copy link
Owner

i have no problem with that, i will look into how to do it during the week ;)

@ChristianKatzmann
Copy link
Contributor

You could take a look at my pull request #170 in which I implemented the basics for the AAR publishing according to Chris Banes' article.

@emilsjolander
Copy link
Owner

awesome, thanks!

@emilsjolander
Copy link
Owner

@ChristianBecker just wanted to update you on the progress because of all your help !

I am currently getting maven set up for SLH with Sonatype but i ran into a fuckup i made early in the project. I chose the package com.emilsjolander(i don't own this domain) instead of se.emilsjolander(i own this domain) which was pure mistake i am paying for now. Because Sonatype needs me to own the domain that i register the library under i need to refactor the library with the se.emilsjolander package name. This will force everyone to update their imports and xml definitions to get thing sworking so that is not fun.

Still thinking of the best way forward but probably i will refactor the package name sometime this week.

@ChristianKatzmann
Copy link
Contributor

Are you sure you have to refactore the package name? Or is it possible to simply publish the artifact under se.emilsjolander even though the actual package name is com.emilsjolander? This would prevent the users from updating their imports and xml definitions.

@emilsjolander
Copy link
Owner

Yes, it might be possible to do that. However i think that would be confusing :/ I am still weighing pros and cons and will update you when i've made a decision 👍

@ChristianKatzmann
Copy link
Contributor

From my point of view it wouldn't be confusing... I know a lot of libraries that are published under a "different domain" compared to the source files. But, just my point of view :)

I'm looking forward for your decision

@emilsjolander
Copy link
Owner

I choose to refactor the package name. The decision was not made lightly but in the end we now have a shorter package name that actually corresponds to a URL that i own.

@ChristianKatzmann
Copy link
Contributor

Alright 👍 You forgot to update the top-level gradle.properties with the new package name.

Do you plan to publish some snapshots to Maven Central before the stable release?

@emilsjolander
Copy link
Owner

oh, i'll get on that. Ya i was planning on doing a stable release once the project is in maven central :)

@ChristianKatzmann
Copy link
Contributor

@emilsjolander : Typo? Did you meant "[..] doing a SNAPSHOT release once [..]"?

@dominicbartl
Copy link

Nice :) Currently using StickyListHeaders in a project which uses Maven. Looking forward to it

@emilsjolander
Copy link
Owner

@ChristianBecker not really a typo. i meant that both of those will happen at the same time ;)

@emilsjolander
Copy link
Owner

I just got access to the central repository so i'll push it up soon 👍

@ChristianKatzmann
Copy link
Contributor

Great to hear 👍

@rharter
Copy link

rharter commented Sep 25, 2013

Any update on getting this in maven central? I was watching your thread yesterday and would love to be able to pull the library into my gradle project.

@emilsjolander
Copy link
Owner

I'm busy ay work and with some other things so will push when i have the time. Also want to wait to see if more bug reports trickle in before doing a release :)

@ChristianKatzmann
Copy link
Contributor

Thats why I would suggest to publish a SNAPSHOT version, so anyone can try the new version of StickyListHeaders. :)

@emilsjolander
Copy link
Owner

Ok so i was about to upload a snapshot but TBH i have no idea where to start. @ChristianBecker you did a great job providing all the gradle files but would you mind also walking me through the process of publishing it to maven central now that i have access to the sonatype repo?

Never published anything via maven or gradle and while i could probably figure it out myself i think it would go faster and be less painful with some help 🐱

@rharter
Copy link

rharter commented Sep 25, 2013

I haven't uploaded to maven central, but I have to my personal Sonatype Nexus server. Based on the gradle files, I believe that as long as the version is a SNAPSHOT version it will upload it to the SNAPSHOT repo provided. I modified the file to point to my personal server and did exactly that and it worked just fine.

The command you want for that is gradle uploadArchives.

On Wednesday, September 25, 2013 at 2:25 PM, Emil Sjölander wrote:

Ok so i was about to upload a snapshot but TBH i have no idea where to start. @ChristianBecker (https://github.com/ChristianBecker) you did a great job providing all the gradle files but would you mind also walking me through the process of publishing it to maven central now that i have access to the sonatype repo?
Never published anything via maven or gradle and while i could probably figure it out myself i think it would go faster and be less painful with some help


Reply to this email directly or view it on GitHub (#164 (comment)).

@ChristianKatzmann
Copy link
Contributor

I'm going to write you tomorrow, when I have more time..
Am 25.09.2013 21:25 schrieb "Emil Sjölander" notifications@github.com:

Ok so i was about to upload a snapshot but TBH i have no idea where to
start. @ChristianBecker https://github.com/ChristianBecker you did a
great job providing all the gradle files but would you mind also walking me
through the process of publishing it to maven central now that i have
access to the sonatype repo?

Never published anything via maven or gradle and while i could probably
figure it out myself i think it would go faster and be less painful with
some help [image: 🐱]


Reply to this email directly or view it on GitHubhttps://github.com//issues/164#issuecomment-25116990
.

@emilsjolander
Copy link
Owner

not to jinx anything but i think i got it working :)

@emilsjolander
Copy link
Owner

Yup 2.0.0-SNAPSHOT is now on maven central

@emilsjolander
Copy link
Owner

deployed a release build but noticed that i had missed signing the library. Will look into that tomorrow

@ChristianKatzmann
Copy link
Contributor

Are you sure that you published the artifact under se.emilsjolander:stickylistheaders:2.x.x@aar and not under se.emilsjolander.stickylistheaders:library:2.x.x ? By default the @aar extension is not necessary and the GROUP as specified in gradle.properties is se.emilsjolander.stickylistheaders.

@emilsjolander
Copy link
Owner

my group is se.emilsjolander i might have forgotten to change that in the gradle.properties though

@bogdanzurac
Copy link

Hi there. Any news on this ? I've tried searching for it on Maven Central, but I couldn't find it. I'm asking because I've started migrating all the projects to Gradle, so it would be awesome to just compile this aar from Central. Thanks a lot !

@emilsjolander
Copy link
Owner

Yeah, i had forgotten to sign the release! I have been at a conference the past 2 days and am moving to germany tomorrow so this might be delayed until next weekend :/

Until then a snapshot should be available at https://oss.sonatype.org/content/repositories/snapshots/se/emilsjolander/stickylistheaders/library/

@ChristianKatzmann
Copy link
Contributor

Thanks 👍

If anyone wants to use this SNAPSHOT release, you have to add the following code to your build.gradle:

repositories {
    maven {
        url 'https://oss.sonatype.org/content/repositories/snapshots/'
    }
}
dependencies {
    compile 'se.emilsjolander.stickylistheaders:library:2.0.0-SNAPSHOT'
}

@bogdanzurac
Copy link

Tried the 2.0.0-SNAPSHOT:

Gradle: Execution failed for task ':Project:processDebugManifest'.

Manifest merging failed. See console for more info.

Removed it, rebuilt, build worked. I suppose there's a difference between the build.gradle defaultConfig values and the version values from the AndroiManifest.xml ?

@ChristianKatzmann
Copy link
Contributor

What is your minSdkVersion ?

@bogdanzurac
Copy link

10

@ChristianKatzmann
Copy link
Contributor

Could you run ./gradlew packageDebug (Linux) or gradlew.bat packageDebug (Windows) and paste the output, please?

@bogdanzurac
Copy link

"Main manifest has but library uses targetSdkVersion='18'"

Epic win for that command, thanks a lot ! 👍
Waiting for lib on Maven Central :D

@joepetrakovich
Copy link

The snapshot isn't resolving for me..

I just get a bunch of resource missing errors.

@emilsjolander
Copy link
Owner

I moved to germany 3 days ago and have still not received any working internet connection. This is why it's taking such a long time

@bogdanzurac
Copy link

@havesomejoe just asking, have you added the Sonatype Maven URL?

@emilsjolander don't worry man, we still have the snapshot or the project lib. It will work until it's up on central.

@bogdanzurac
Copy link

Update: the SNAPSHOT on Sonatype includes the bug listed here (#187), which I can't get fixed by using the described method.
Do you intend to publish a non-SNAPSHOT release on Maven Central, or also a SNAPSHOT ? Or another SNAPSHOT on Sonatype ? Just asking so that I know what to do.

@emilsjolander
Copy link
Owner

it's coming! i just have a lot to do right now so publishing to maven is not my prio. If you always want to latest bug fixes i suggest you clone the repository as this will always be a couple of fixes/improvements ahead of maven central.

@emilsjolander
Copy link
Owner

update! We should be able to close this issue some time this week. I just released the first artifact and am just waiting for sonatype to sync it to central. Will update this issue when it's complete

@dominicbartl
Copy link

Sounds awesome. I'm currently using it in a project and can't wait to move the last dependency to Maven.

@ChristianKatzmann
Copy link
Contributor

Ok, this can by closed now! The new update (2.0.1) is now available in MavenCentral. Simply add compile 'se.emilsjolander.stickylistheaders:library:2.0.1' as a dependency to your build.gradle and it should work :)

@emilsjolander
Copy link
Owner

awesome. i didn't even notice it! Thanks for all the help people!

@bogdanzurac
Copy link

It works beautifully, thank you both for your effort !

@paulovap
Copy link
Author

Excelent work! Thank you all involved.

@dominicbartl
Copy link

I'm just getting started with Maven and haven't done anything with Gradle yet, so please correct me if I'm wrong or there's a different solution.

As above, my team isn't currently using Gradle and from what I've found out aar files are used in Gradle builds. It seems that the latest version of the Android Maven Plugin 3.7.0 added experimental support for consuming aar files, however i didn't get it to work.
Would it be possible to publish an apkLib on Maven Central too?

@ChristianKatzmann
Copy link
Contributor

Don't investigate too much time for "getting started with Maven". Switch directly to Gradle since this is the new Android Build system. 👍 (Just my two cents)

@gabrielittner
Copy link
Contributor

@Bartinger According to this post https://groups.google.com/d/msg/maven-android-developers/xONb4q_xiic/Wp2wMVVzIlkJ which is newer the consumption isn't working yet.

@dominicbartl
Copy link

@ChristianBecker I just watched the complete Android Gradle talk of the I/O and it seems that this is the best and future proof solution.

@gabrielittner Thanks, I won't invest more time into integrating it with Maven.

@ihsanbal
Copy link

where apklib support for loyal maven users?

@seato
Copy link
Contributor

seato commented May 21, 2014

@ihsanbal Add a pom.xml to the library directory with the following:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.se.emilsjolander</groupId>
<artifactId>library</artifactId>
<version>2.3.0</version>
<packaging>apklib</packaging>
<name>StickyListHeaders Library</name>
<dependencies>
    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>4.1.1.4</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
<build>
    <sourceDirectory>src</sourceDirectory>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.8.2</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>com.jayway.maven.plugins.android.generation2</groupId>
            <artifactId>android-maven-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <release>false</release>
                <sign>
                    <debug>true</debug>
                </sign>
                <sdk>
                    <platform>17</platform>
                </sdk>
                <zipalign>
                    <skip>false</skip>
                    <verbose>true</verbose>
                </zipalign>
            </configuration>
            <executions>
                <execution>
                    <id>alignApk</id>
                    <phase>package</phase>
                    <goals>
                        <goal>zipalign</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
</project>

Build that from the directory level and add it to your project as a third party lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants