Unable to define publication credentials

Im trying to publish my Project to mavenCentral; I am using this code:

publishing {
    repositories {
        maven {
            credentials {
                username 'username'
                password 'password'
            }
            def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
            def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
            url = snapshotsRepoUrl
            name = "Sonatype"
        }
    }

and it spits out:

FAILURE: Build failed with an exception.

* Where:
Build file 'A:\Workspaces\CrystalShard\build.gradle' line: 102

* What went wrong:
Exception thrown while executing model rule: PublishingPluginRules#publishing(ExtensionContainer)
> Could not find method credentials() for arguments [build_4scp0jih37lexpuk5twd6xjk6$_run_closure11$_closure32$_closure35$_closure36@1db94cce] on object of type org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings

CONFIGURE FAILED in 2s
Could not find method credentials() for arguments [build_4scp0jih37lexpuk5twd6xjk6$_run_closure11$_closure32$_closure35$_closure36@1db94cce] on object of type org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication.

i just fail to find any online help on this, i hope someone can help me

holy shit, im stupid.

the second i put this issue i figured it out; i still had a credentials block somewhere else. i should get a coffee. geez.

[closed]