simonpoole / OpeningHoursParser

Parser for string values according to the OSM opening hours specification
MIT License
32 stars 12 forks source link

Building project throws error related to publishing part in build.gradle #59

Closed goodudetheboy closed 3 years ago

goodudetheboy commented 3 years ago

When I try to build project, it returns error Could not get unknown property 'ossrhUsername' for Credentials [username: null] of type org.gradle.internal.credentials.DefaultPasswordCredentials_Decorated.

This might be because of the publishing to Maven part in the build.gradle file. This was solved by removing/commenting out in the gradle file

apply plugin: 'maven-publish'
apply plugin: 'signing'

and

publishing {
    publications {
        Release(MavenPublication) {
            groupId 'ch.poole'
            artifactId 'OpeningHoursParser'
            artifact jar
            artifact sourcesJar
            artifact javadocJar
            pom {
                name = artifactId
                description = 'This is a simple parser for OSM "opening_hours" tags'    
                url = 'https://github.com/simonpoole/OpeningHoursParser'
                scm {
                    url = repoUrl
                }
                licenses {
                    license {
                        name = spdxId
                        url = 'https://raw.githubusercontent.com/simonpoole/OpeningHoursParser/master/LICENCE.txt'
                    }
                }
                developers {
                    developer {
                        name = 'Simon Poole'
                    }
                }
            }
            repositories {
                maven {
                    name = 'sonatype'
                    credentials {
                        username ossrhUsername
                        password ossrhPassword
                    }
                    def releasesRepoUrl = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
                    def snapshotsRepoUrl = "https://s01.oss.sonatype.org/content/repositories/snapshots/"
                    url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
                }
            }
        }
    }
}

signing {
    sign publishing.publications.Release
}

Optionally, there can be an extra build file (with the part above removed) for local run.

simonpoole commented 3 years ago

Yes that is an artifact of moving to sonatype for publishing, you can simply add dummy values to your account level gradle.properties. We should probably move to getting these from the environment instead so that things will compile out of the box.

goodudetheboy commented 3 years ago

Noted. Thanks for the clarification.

simonpoole commented 3 years ago

Fixed in https://github.com/simonpoole/OpeningHoursParser/commit/bdd10098f3948eb2ce9be4c68123755b53008364