Publish not picking up version and group

So i have this client level plugin

package com.mycompany.Myapp.dir

import com.mycompany.Myapp.core.MyappCorePlugin
import com.mycompany.Myapp.lib.validation.MyappDependsOn
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar

import static com.mycompany.Myapp.lib.ProjectTaskCreater.addPluginLocal


/**
 * TODO Make sure this project is stand alone.  It can't be a subproject or have subprojects
 */
class MyappDirPlugin implements Plugin<Project> {

    @Override
    @SuppressWarnings("GroovyAssignabilityCheck")
    void apply(Project project) {

        addPluginLocal(project, MyappCorePlugin)

        project.with {

            jar {
                setExtension("zip")
            }

            publishing.publications {
                dirproj(MavenPublication) {
                    from components.java
                }
            }
            def compileConfig = configurations.findByName('compile')
            artifactoryPublish {
                publications << 'dirproj'
            }

            sourceSets {
                main {
                    java {
                        srcDirs = []
                    }
                    groovy {
                        srcDirs = []
                    }
                    resources {
                        srcDirs = ['src/server_classpath']
                    }
                    output.classesDir "$buildDir/dir"
                    output.resourcesDir "$buildDir/dir"

                }
                test {
                    java {
                        srcDirs = []
                    }
                    groovy {
                        srcDirs = []
                    }
                    resources {
                        srcDirs = []
                    }
                }
            }
        }
    }
}

This particular plugin is supposed to add a folder of property files into the classpath of whatever project and publish them as a zip file.

now, the core plugin at the top implements artifactory and nebula. its VERY basic:

    addPluginAllProjects(project, MavenPublishPlugin)
    addPluginAllProjects(project, MavenPlugin)
    addPluginAllProjects(project, ArtifactoryPlugin)

def retMap = checkArtifactoryActive(project)
if (retMap != null) {
    artifactory {
        contextUrl = retMap[PARAMETER_ARTIFACTORYCONTEXT]
        publish {
            repository {
                repoKey = retMap[PARAMETER_ARTIFACTORYREPO]
                username = retMap[PARAMETER_ARTIFACTORYUSER]
                password = retMap[PARAMETER_ARTIFACTORYPASS]
                maven = true
            }
            defaults {
                publications ('nebula')
                publishConfigs(ARTIFACTORY_CONFIGURATION_ARCHIVES, ARTIFACTORY_CONFIGURATION_PUBLISHED)
                publishArtifacts = true
                publishPom = true
            }
        }
    }
}

Now, i keep getting errors stating that it can’t find example.jar. After 4 days of farting around trying different things, i finally opened up the pom file.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
  <groupId/>
  <artifactId>dirproj</artifactId>
  <version>unspecified</version>
  <packaging>zip</packaging>
  <name>exampledir</name>
  <description/>
  <properties>
    <nebula_Manifest_Version>1.0</nebula_Manifest_Version>
    <nebula_Implementation_Title>#exampledir;unspecified</nebula_Implementation_Title>
    <nebula_Implementation_Version>unspecified</nebula_Implementation_Version>
    <nebula_Built_Status>integration</nebula_Built_Status>
    <nebula_Built_By>me</nebula_Built_By>
    <nebula_Built_OS>Windows 7</nebula_Built_OS>
    <nebula_Build_Date>2017-02-06_10:24:32</nebula_Build_Date>
    <nebula_Gradle_Version>3.3</nebula_Gradle_Version>
    <nebula_Module_Source>C:/code/SDA/example/exampledir</nebula_Module_Source>
    <nebula_Module_Origin>LOCAL</nebula_Module_Origin>
    <nebula_Build_Host>myhost</nebula_Build_Host>
    <nebula_Build_Job>LOCAL</nebula_Build_Job>
    <nebula_Build_Number>LOCAL</nebula_Build_Number>
    <nebula_Build_Id>LOCAL</nebula_Build_Id>
    <nebula_Created_By>1.8.0_66-b17 (Oracle Corporation)</nebula_Created_By>
    <nebula_Build_Java_Version>1.8.0_66</nebula_Build_Java_Version>
    <nebula_Module_Owner></nebula_Module_Owner>
    <nebula_Module_Email></nebula_Module_Email>
    <nebula_X_Compile_Target_JDK>1.8</nebula_X_Compile_Target_JDK>
    <nebula_X_Compile_Source_JDK>1.8</nebula_X_Compile_Source_JDK>
  </properties>
  <scm>
    <url>LOCAL</url>
  </scm>
</project>

Notice the group and version are blank? Now, what is different is in my build the group and version are not in the build file, the group comes from our inventory system that the core queries, and the version is passed in as a parameter to the build. Those items are queried and set in an afterEvaluate block in the core plugin. This is the first system that didn’t see it. Can anyone see what im doing wrong?

Well, solved part of it. Turns out the publish plugin isn’t change aware. Meaning when my afterEvaluate block executed, none of the other plugins were updated as to the new version. When i wrapped the publishing block in an afterEvaluate, then the version numbers came up. Still doesn’t solve my problem, its still looking for the wrong file, but hey, its a new error which is progress.

I think my inventory system is flawed. How do i specify that a task execute first, no matter what. I don’t care what task is run, clean, info, jar, don’t care. under 100% of circumstances, i want task “validateInventory” to run first, but its useless if the build.gradle file isn’t already parsed. as the inventory lookup tag is in an extension, in the build file. But i can just as easily move that out of the build and into a property file if needed. I think running it first will solve a great deal of problems. So how do i do that?