DEV Community

Query Filter
Query Filter

Posted on

bridge14

// 1. Force-define the property at the project level
project.ext.mainClassName = "comet.agent.UniversalAttacher"

// 2. Ensure the 'application' extension doesn't cause a crash
if (!project.plugins.hasPlugin('application')) {
    project.extensions.extraProperties.set('mainClassName', "comet.agent.UniversalAttacher")
}

=================

shadowJar {
    dependsOn buildAgent, compileAttacher

    group = "Distribution"
    description = "Builds the universal attacher + agent suite"

    archiveBaseName.set('profiler-all-in-one')
    archiveClassifier.set('all') 

    // Explicitly tell the task which main class to use for its internal checks
    mainClassName = "comet.agent.UniversalAttacher"

    from compileAgent.destinationDirectory
    from compileAttacher.destinationDirectory

    manifest {
        attributes(
            'Main-Class': 'comet.agent.UniversalAttacher',
            'Premain-Class': 'comet.agent.ProfilerAgent',
            'Agent-Class': 'comet.agent.ProfilerAgent',
            'Can-Redefine-Classes': 'true',
            'Can-Retransform-Classes': 'true'
        )
    }

    configurations = [project.configurations.runtimeClasspath]
    relocate 'net.bytebuddy', 'comet.shaded.bytebuddy'
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)