DEV Community

Query Filter
Query Filter

Posted on

bridge12

shadowJar {
    dependsOn buildAgent, compileAttacher

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

    archiveBaseName.set('profiler-all-in-one')
    archiveClassifier.set('all') // Prevents "mainClassName" lookup errors in some versions

    // Reusing classes from your existing agent and the new attacher
    from compileAgent.destinationDirectory
    from compileAttacher.destinationDirectory

    // This line solves the "mainClass" error by manually setting the Manifest
    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'
        )
    }

    // Merge dependencies (ByteBuddy)
    configurations = [project.configurations.runtimeClasspath]

    // Relocate to avoid conflicts in CPLS/COMET
    relocate 'net.bytebuddy', 'comet.shaded.bytebuddy'
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)