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

Initial Setup #6

Closed
jpage4500 opened this issue Mar 23, 2017 · 5 comments
Closed

Initial Setup #6

jpage4500 opened this issue Mar 23, 2017 · 5 comments

Comments

@jpage4500
Copy link

just wanted to report my findings as I tried to follow the main instructions

  1. after creating my project in google cloud console, updating the users.txt and appengine-web.xml and running ./gradlew appengineUpdate I got the following error:
WARNING: Error posting to URL: https://appengine.google.com/api/appversion/getresourcelimits?app_id=bleachr-maven-repo&version=v1&
404 Not Found
This application does not exist (project_id=u'bleachr-maven-repo'). To create an App Engine application in this project, run "gcloud app create" in your console.
This is try #0

Could this have changed on google's side?
As soon as your project is created, a default Google Cloud storage bucket has been automatically created for you

I ended up signing up for a 'free trial' (not sure if I'm going to get billed after or not), enabling the google console shell and finally running the command gcloud app create

After this the ./gradlew appengineUpdate command worked!

@renaudcerrato
Copy link
Owner

Mmmm..... Not sure what happened to you. You should have been able to create your appengine project from the console also.

Anyway, you won't be charged as long as you're under your free quotas, and they're quite high for a personal usage.

@jpage4500
Copy link
Author

I'm getting closer to getting everything to work.. I should also say I'm trying to use this for hosting a private android library so some of this is probably a more specialized case..

anyway, here's what I've got so far.. it looks like if I want to upload my .aar library I've got to use this in my library's build.gradle file which is a little different than the instructions:

apply plugin: 'maven-publish'

then, at the bottom:

publishing {
    repositories {
        maven {
            url 'https://my-repo-name.appspot.com'
            credentials {
                username 'admin'
                password 'admin'
            }
        }
    }

    publications {
        aar(MavenPublication) {
            groupId 'com.project'
            artifactId 'library-name'
            version '1.0.0'

            artifact("$buildDir/outputs/aar/${archivesBaseName}-release.aar")
        }
    }
}

Then, upload using gradlew publish

Maybe this isn't necessary.. I'm still learning about how to include an Android .aar library into a project..

also, when referencing the library from another app I had to include "@aar" otherwise I'd get an error saying it didn't find the '.jar' file..

    compile 'com.project:my-library:1.0.0@aar'

Anyway - I wanted to write all of this down in case it helps someone else who happens upon this excellent project..

@ductranit
Copy link

ductranit commented May 5, 2017

@jpage4500 @renaudcerrato do you know how to add dependencies to POM from aar module?
I use this script to generate dependencies but it only generates for appengine java project instead of aar module

pom.withXml {
                def dependenciesNode = asNode().appendNode('dependencies')

                // List all compile dependencies and write to POM
                configurations.compile.getAllDependencies().each { Dependency dep ->
                    if (dep.group == null || dep.version == null || dep.name == null || dep.name == "unspecified")
                        return // ignore invalid dependencies

                    def dependencyNode = dependenciesNode.appendNode('dependency')
                    dependencyNode.appendNode('groupId', dep.group)
                    dependencyNode.appendNode('artifactId', dep.name)
                    dependencyNode.appendNode('version', dep.version)

                    if (!dep.transitive) {
                        // If this dependency is transitive, we should force exclude all its dependencies them from the POM
                        def exclusionNode = dependencyNode.appendNode('exclusions').appendNode('exclusion')
                        exclusionNode.appendNode('groupId', '*')
                        exclusionNode.appendNode('artifactId', '*')
                    } else if (!dep.properties.excludeRules.empty) {
                        // Otherwise add specified exclude rules
                        def exclusionsNode = dependencyNode.appendNode('exclusions')
                        dep.properties.excludeRules.each { ExcludeRule rule ->
                            def exclusionNode = exclusionsNode.appendNode('exclusion')
                            exclusionNode.appendNode('groupId', rule.group ?: '*')
                            exclusionNode.appendNode('artifactId', rule.module ?: '*')
                        }
                    }
                }
            }

And result:

<dependencies>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey</groupId>
      <artifactId>jersey-bom</artifactId>
      <version>2.24</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.containers</groupId>
      <artifactId>jersey-container-servlet</artifactId>
      <version>2.24</version>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jersey.ext</groupId>
      <artifactId>jersey-mvc-mustache</artifactId>
      <version>2.24</version>
    </dependency>
    <dependency>
      <groupId>com.google.appengine.tools</groupId>
      <artifactId>appengine-gcs-client</artifactId>
      <version>0.6</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-jdk14</artifactId>
      <version>1.7.18</version>
    </dependency>
  </dependencies>

If I add this script into my module, it generate correctly, but it is in module/build/pom.xml
My current project structure:
Project

  • App (contains appengine gradle)
  • module 1
  • module 2
  • gradle.properties (define artifactId, group...)

@renaudcerrato
Copy link
Owner

renaudcerrato commented May 5, 2017 via email

@renaudcerrato
Copy link
Owner

I'm closing this pull-request, since I added an examples directory. Feel free to add your maven example.

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

No branches or pull requests

3 participants