Publishing Play framework distribution JAR failures

I’d like to publish a JAR for a Play framework (2.3.7, java 1.8) project that depends on another Play app so that I can convert us from SBT to Gradle in pieces. However, the maven-publish plugin doesn’t seem to recognize the “java”, “scala” or “play” components. For example using the “maven-publish” plugin:

publishing {
    publications {
        mavenPlay(MavenPublication) {

throws this error:

Exception thrown while executing model rule: PublishingPlugin.Rules#publishing
Could not find property ‘java’ on SoftwareComponentInternal set.

Which is surprising because the “play” plugin pulls in the “java” and “scala” plugins.

It seems like one could easily fix this by applying the “java” or “scala” or “maven” plugins; however, it seems like the “play” plugin and other plugins are in conflict because I get this error:

Failed to apply plugin [class ‘org.gradle.api.plugins.BasePlugin’]
Cannot add a configuration with name ‘default’ as a configuration with that name already exists.

I could use your guys’ advice to move forward.

Turns out there’s a rather obvious solution to this:

publications {
    maven(MavenPublication) {
        artifact createPlayBinaryAssetsJar
        artifact createPlayBinaryDistributionJar

// plus some code to put assets in the right place in the dist JAR and combine the JARs
1 Like


Which gradle version are you using? Is there an example project I can have a look?

Hi Matthew,

This was using Gradle 2.8. I’m afraid I can’t share the project, but if it’s important for you in order to fix any gaps, I can consider coming up with a simple example that shows the issue.

I haven’t gone back to this after initially solving it awhile back. It’s possible this now works in Gradle 2.10.


That would be great!

  • Matthew