Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Creating and uploading file to AEM instance via CRX using tools
package org.aem.sync.kotlin
import io.wcm.tooling.commons.contentpackagebuilder.ContentPackageBuilder
import io.wcm.tooling.commons.packmgr.PackageManagerProperties
import io.wcm.tooling.commons.packmgr.install.PackageFile
import io.wcm.tooling.commons.packmgr.install.PackageInstaller
import io.wcm.tooling.commons.packmgr.install.VendorInstallerFactory
fun main(args: Array<String>) {
val file = File("")
val builder = ContentPackageBuilder()
.rootPath("/apps/mysample/config") { contentPackage ->
val myFile = File(ClassLoader.getSystemClassLoader().getResource("file.txt").file)
contentPackage.addFile("/apps/mysample/config/file1.txt", myFile)
val props = PackageManagerProperties()
props.userId = "admin"
props.password = "admin"
props.packageManagerUrl = "http://localhost:4502" + VendorInstallerFactory.CRX_URL
val packageFile = PackageFile()
packageFile.file = file
val logger = MyLogger()
val packageInstaller = PackageInstaller(props, logger)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.