Slackbot
12/20/2023, 1:47 PMChris Lee
12/20/2023, 2:10 PMjava-library plugin handles all that for you, with some minor configuration to enable sources/javadoc jar generation,Dipak Bachhav
12/20/2023, 3:16 PMapply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'idea'
apply plugin: 'maven-publish'Chris Lee
12/20/2023, 3:17 PMDipak Bachhav
12/20/2023, 3:30 PMsrc/test and src/main directories contain some generic code (consider this project as a base project). I am trying to publish two JAR files using Gradle 8.2. The first one is for src/main, and the other is for src/test.
I am facing an issue while creating the JAR for src/test. When I perform ./gradle publish, the JAR file is created in Azure. However, the dependencies used in my base project are not available in the src/test JAR. Additionally, I can't import code from src/test my base project into another project where I am using that JARChris Lee
12/20/2023, 3:33 PMDipak Bachhav
12/20/2023, 3:34 PMChris Lee
12/20/2023, 4:47 PMDipak Bachhav
12/20/2023, 4:48 PMDipak Bachhav
12/20/2023, 4:49 PMChris Lee
12/20/2023, 4:50 PMtestFixtures block? Neither of those are necessary for test fixtures to be packaged and published.Dipak Bachhav
12/20/2023, 4:51 PMChris Lee
12/20/2023, 5:13 PMimplementation(testFixtures("com.yourcompany:basemain-project:8.0.0-SNAPSHOT"))
btw, terminology wise - for gradle a ‘project’ dependency is another project in the same build; this is an external artifact dependency (even if its one of your own published artifacts).Dipak Bachhav
12/20/2023, 5:18 PMChris Lee
12/20/2023, 5:20 PMDipak Bachhav
12/20/2023, 5:28 PMChris Lee
12/20/2023, 5:29 PMgroup = "whatever…".Chris Lee
12/20/2023, 5:30 PMgradle.properties to avoid repeating it for each project.Chris Lee
12/20/2023, 5:30 PMversionChris Lee
12/20/2023, 5:32 PMjava-library, publishing, test fixtures?Dipak Bachhav
12/20/2023, 5:34 PMapply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'idea'
apply plugin: "net.serenity-bdd.serenity-gradle-plugin"
apply plugin: 'application'
apply plugin: 'org.sonarqube'
apply plugin: 'maven-publish'
apply plugin: 'java-test-fixtures'Dipak Bachhav
12/20/2023, 5:53 PMChris Lee
12/20/2023, 6:44 PM