Add gradle init script for JFrog CLI
This commit is contained in:
13
.github/workflows/continuous-integration-43x.yml
vendored
13
.github/workflows/continuous-integration-43x.yml
vendored
@@ -23,11 +23,6 @@ jobs:
|
||||
java-version: '8'
|
||||
distribution: 'adopt'
|
||||
|
||||
- name: Extract project version
|
||||
run: |
|
||||
./gradlew clean
|
||||
echo PROJECT_VERSION=$(./gradlew properties | grep version | cut -d: -f2 | xargs) >> $GITHUB_ENV
|
||||
|
||||
- name: Setup JFrog Cli
|
||||
uses: jfrog/setup-jfrog-cli@901bb9632db90821c2d3f076012bdeaf66598555 # v3.4.1
|
||||
env:
|
||||
@@ -41,11 +36,5 @@ jobs:
|
||||
|
||||
- name: Build the project and Deploy to Artifactory
|
||||
run: |
|
||||
jf gradle build install -x test
|
||||
echo "Copying spring-batch-infrastructure/build/poms/pom-default.xml to spring-batch-infrastructure/build/libs/spring-batch-infrastructure-$PROJECT_VERSION.pom"
|
||||
cp spring-batch-infrastructure/build/poms/pom-default.xml spring-batch-infrastructure/build/libs/spring-batch-infrastructure-$PROJECT_VERSION.pom
|
||||
cp spring-batch-core/build/poms/pom-default.xml spring-batch-core/build/libs/spring-batch-core-$PROJECT_VERSION.pom
|
||||
cp spring-batch-test/build/poms/pom-default.xml spring-batch-test/build/libs/spring-batch-test-$PROJECT_VERSION.pom
|
||||
cp spring-batch-integration/build/poms/pom-default.xml spring-batch-integration/build/libs/spring-batch-integration-$PROJECT_VERSION.pom
|
||||
jf gradle artifactoryPublish
|
||||
jf gradle build install artifactoryPublish -x test -I gradle/initscript.gradle
|
||||
jf rt build-publish
|
||||
|
||||
38
gradle/initscript.gradle
Normal file
38
gradle/initscript.gradle
Normal file
@@ -0,0 +1,38 @@
|
||||
import org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin
|
||||
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask
|
||||
|
||||
initscript {
|
||||
dependencies {
|
||||
classpath fileTree('${pluginLibDir}')
|
||||
}
|
||||
}
|
||||
|
||||
addListener(new BuildInfoPluginListener())
|
||||
|
||||
class BuildInfoPluginListener extends BuildAdapter {
|
||||
|
||||
def void projectsLoaded(Gradle gradle) {
|
||||
Map<String, String> projectProperties = new HashMap<String, String>(gradle.startParameter.getProjectProperties())
|
||||
projectProperties.put("build.start", Long.toString(System.currentTimeMillis()))
|
||||
gradle.startParameter.setProjectProperties(projectProperties)
|
||||
Project root = gradle.getRootProject()
|
||||
root.logger.debug("Artifactory plugin: projectsEvaluated: ${root.name}")
|
||||
if (!"buildSrc".equals(root.name)) {
|
||||
root.allprojects {
|
||||
apply {
|
||||
apply plugin: ArtifactoryPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set the "mavenJava" and "ivyJava" publications or
|
||||
// "archives" configuration to all Artifactory tasks.
|
||||
for (Project p : root.getAllprojects()) {
|
||||
Task t = p.getTasks().findByName(ArtifactoryTask.ARTIFACTORY_PUBLISH_TASK_NAME)
|
||||
if (t != null) {
|
||||
ArtifactoryTask task = (ArtifactoryTask) t
|
||||
task.setCiServerBuild()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user