How to put images to media folder on install (J1.7)? - joomla

I have mu install.xml file with:
<media destination="com_mycomp/images" folder="media">
<filename>images/file1.png</filename>
<filename>images/file2.gif</filename>
</media>
and during the installation folders are created but do not copy the files? Why?
My component folder structure:
com_mycomp
|
install.xml
|
+--- site
| |
| + (...)
|
+--- admin
| |
| + (...)
|
+--- media
|
+ images
|
+ file1.png
|
+ file2.gif
How to put files to media folder on installation?

<media destination="com_mycomp" folder="media">
<folder>images</folder>
</media>
use this sample code and it will upload all file in images folder

Related

Proper way to switch Spring Data release train in Spring Boot Gradle Plugin

I am trying to build a new up to date Spring Boot project but cannot find a way to switch Spring Data release train. We are using Elasticsearch with version 6.8 so I cannot just go with default dependencies provided by Spring Boot.
Spring Data Elasticsearch reference page tells that to use version 6.8 I need to use Moore release train https://docs.spring.io/spring-data/elasticsearch/docs/current/reference/html/#preface.versions.
I have seen documentation for Maven https://docs.spring.io/spring-boot/docs/2.1.10.RELEASE/reference/html/using-boot-build-systems.html#using-boot-maven-without-a-parent but same documentation for Gradle is lacking Release Train switch example https://docs.spring.io/spring-boot/docs/2.1.10.RELEASE/gradle-plugin/reference/html/#managing-dependencies-using-in-isolation.
In short I have the following pieces in my build.gradle:
plugins {
id 'org.springframework.boot' version '2.3.5.RELEASE'
id 'io.spring.dependency-management' version '1.0.10.RELEASE'
id 'java'
}
dependencyManagement {
imports {
mavenBom 'org.springframework.data:spring-data-releasetrain:Moore-SR11'
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-elasticsearch'
}
Switching BOM in dependencyManagement section helps to switch spring-data-elasticsearch version from 4.0.5.RELEASE to 3.2.11.RELEASE but the version of elasticsearch is still taken as 7.6.2 from somewhere (gradle dependencies output):
+--- org.springframework.boot:spring-boot-starter-data-elasticsearch -> 2.3.5.RELEASE
| +--- org.springframework.boot:spring-boot-starter:2.3.5.RELEASE (*)
| \--- org.springframework.data:spring-data-elasticsearch:4.0.5.RELEASE -> 3.2.11.RELEASE
| +--- org.springframework:spring-context:5.2.10.RELEASE (*)
| +--- org.springframework:spring-tx:5.2.10.RELEASE (*)
| +--- org.springframework.data:spring-data-commons:2.2.11.RELEASE
| | +--- org.springframework:spring-core:5.2.10.RELEASE (*)
| | +--- org.springframework:spring-beans:5.2.10.RELEASE (*)
| | \--- org.slf4j:slf4j-api:1.7.26 -> 1.7.30
| +--- joda-time:joda-time:2.10.8
| +--- org.elasticsearch.plugin:transport-netty4-client:6.8.13 -> 7.6.2
| | +--- io.netty:netty-buffer:4.1.43.Final -> 4.1.53.Final
| | +--- io.netty:netty-codec:4.1.43.Final -> 4.1.53.Final
| | +--- io.netty:netty-codec-http:4.1.43.Final -> 4.1.53.Final
| | +--- io.netty:netty-common:4.1.43.Final -> 4.1.53.Final
| | +--- io.netty:netty-handler:4.1.43.Final -> 4.1.53.Final
| | +--- io.netty:netty-resolver:4.1.43.Final -> 4.1.53.Final
| | \--- io.netty:netty-transport:4.1.43.Final -> 4.1.53.Final
| +--- org.elasticsearch.client:elasticsearch-rest-high-level-client:6.8.13 -> 7.6.2
| | +--- org.elasticsearch:elasticsearch:7.6.2
Is there a good example available or what am I missing here?
UPDATE: I found why I have version 7.6.2 taken for Elasticsearch. It is coming from spring-boot-dependencies project https://github.com/spring-projects/spring-boot/blob/v2.3.5.RELEASE/spring-boot-project/spring-boot-dependencies/build.gradle#L274.
Still looking for a way to override it.
With gradle and the java-platform plugin, we had some success by aligning dependencies version as described at https://docs.gradle.org/current/userguide/dependency_version_alignment.html#sec:align-versions-unpublished
This overrides the version resolved for all org.elasticsearch* dependencies to 6.8.13
class ElasticSearchBomAlignmentRule implements ComponentMetadataRule {
void execute(ComponentMetadataContext ctx) {
ctx.details.with {
// Force specific ES version
if (id.group.startsWith("org.elasticsearch")) {
// declare that Elastic Search modules all belong to the ES virtual platform
belongsTo("org.elasticsearch:elasticsearch-virtual-platform:6.8.13")
}
}
}
}
dependencies {
components.all(ElasticSearchBomAlignmentRule)
...
In our experience, it was also needed to downgrade spring-data-elasticsearch but this is much easier and was done with a constraint in the platform
ext {
...
// Downgrade below the boot integration for compatibility with es 6.8.X
springDataEsVersion = '3.2.12.RELEASE'
...
}
dependencies {
...
constraints {
api "org.springframework.data:spring-data-elasticsearch:$springDataEsVersion"
...
}
}

Gradle api configuration not working as expected

I am having trouble understanding the difference between the api and implementation configurations in Gradle. I know this has been asked before, but they seem to behave exactly oppositely of how everyone describes. I have three Gradle projects: consumer -> libraryA -> libraryB. libraryA has an api dependency on libraryB, and consumer has an implementation dependency on libraryA, however libraryB is not available on any classpath in consumer. When I change libraryA to have an implementation dependency on libraryB, libraryB becomes available on the runtimeClasspath of consumer. This does not seem to comport with what everyone is saying. What am I missing?
libraryB
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Kotlin library project to get you started.
*/
plugins {
maven
id("org.jetbrains.kotlin.jvm").version("1.3.31")
}
group = "libraryB"
repositories {
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
// Use the Kotlin JDK 8 standard library.
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
// Use the Kotlin JUnit integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}
libraryA:
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Kotlin library project to get you started.
*/
plugins {
maven
id("org.jetbrains.kotlin.jvm").version("1.3.31")
}
group = "libraryA"
repositories {
mavenLocal()
jcenter()
}
dependencies {
// if I change this to implementation, libraryB will be on the runtime classpath of consumer
api("libraryB:libraryB:unspecified")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
// Use the Kotlin JUnit integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}
consumer:
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Kotlin application project to get you started.
*/
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin on the JVM.
id("org.jetbrains.kotlin.jvm").version("1.3.31")
// Apply the application plugin to add support for building a CLI application.
application
}
group = "com.consumer"
repositories {
mavenLocal()
// Use jcenter for resolving dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
implementation("libraryA:libraryA:unspecified")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
// Use the Kotlin JUnit integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}
application {
// Define the main class for the application
mainClassName = "com.consumer.AppKt"
}
In consumer: gradle dependencies
> Task :dependencies
------------------------------------------------------------
Root project
------------------------------------------------------------
-api (n)
No dependencies
-runtime (n)
+--- libraryA:libraryA:unspecified (n)
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (n)
annotationProcessor - Annotation processors and their dependencies for source set 'main'.
No dependencies
api - API dependencies for compilation 'main' (target (jvm)). (n)
No dependencies
apiDependenciesMetadata
No dependencies
apiElements - API elements for main. (n)
No dependencies
archives - Configuration for archive artifacts.
No dependencies
compileClasspath - Compile classpath for compilation 'main' (target (jvm)).
+--- libraryA:libraryA:unspecified
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains:annotations:13.0
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
\--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
compileOnly - Compile only dependencies for compilation 'main' (target (jvm)). (n)
No dependencies
compileOnlyDependenciesMetadata
No dependencies
default - Configuration for default artifacts.
+--- libraryA:libraryA:unspecified
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| | \--- org.jetbrains:annotations:13.0
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (*)
implementation - Implementation only dependencies for compilation 'main' (target (jvm)). (n)
+--- libraryA:libraryA:unspecified (n)
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (n)
implementationDependenciesMetadata
+--- libraryA:libraryA:unspecified
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains:annotations:13.0
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
\--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
kotlinCompilerClasspath
\--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.31
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains:annotations:13.0
+--- org.jetbrains.kotlin:kotlin-script-runtime:1.3.31
+--- org.jetbrains.kotlin:kotlin-reflect:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
\--- org.jetbrains.intellij.deps:trove4j:1.0.20181211
kotlinCompilerPluginClasspath
\--- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.3.31
kotlinNativeCompilerPluginClasspath
No dependencies
kotlinScriptDef - Script filename extensions discovery classpath configuration
No dependencies
kotlinScriptDefExtensions
No dependencies
runtimeClasspath - Runtime classpath of compilation 'main' (target (jvm)).
+--- libraryA:libraryA:unspecified
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| | \--- org.jetbrains:annotations:13.0
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (*)
runtimeElements - Elements of runtime for main. (n)
No dependencies
runtimeOnly - Runtime only dependencies for compilation 'main' (target (jvm)). (n)
No dependencies
runtimeOnlyDependenciesMetadata
No dependencies
sourceArtifacts (n)
No dependencies
testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
No dependencies
testApi - API dependencies for compilation 'test' (target (jvm)). (n)
No dependencies
testApiDependenciesMetadata
No dependencies
testCompileClasspath - Compile classpath for compilation 'test' (target (jvm)).
+--- libraryA:libraryA:unspecified
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| | \--- org.jetbrains:annotations:13.0
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
+--- org.jetbrains.kotlin:kotlin-test:1.3.31
| +--- org.jetbrains.kotlin:kotlin-test-common:1.3.31
| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
\--- org.jetbrains.kotlin:kotlin-test-junit:1.3.31
+--- org.jetbrains.kotlin:kotlin-test-annotations-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
+--- org.jetbrains.kotlin:kotlin-test:1.3.31 (*)
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
testCompileOnly - Compile only dependencies for compilation 'test' (target (jvm)). (n)
No dependencies
testCompileOnlyDependenciesMetadata
No dependencies
testImplementation - Implementation only dependencies for compilation 'test' (target (jvm)). (n)
+--- org.jetbrains.kotlin:kotlin-test:1.3.31 (n)
\--- org.jetbrains.kotlin:kotlin-test-junit:1.3.31 (n)
testImplementationDependenciesMetadata
+--- libraryA:libraryA:unspecified
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| | \--- org.jetbrains:annotations:13.0
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
+--- org.jetbrains.kotlin:kotlin-test:1.3.31
| +--- org.jetbrains.kotlin:kotlin-test-common:1.3.31
| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
\--- org.jetbrains.kotlin:kotlin-test-junit:1.3.31
+--- org.jetbrains.kotlin:kotlin-test-annotations-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
+--- org.jetbrains.kotlin:kotlin-test:1.3.31 (*)
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
testKotlinScriptDef - Script filename extensions discovery classpath configuration
No dependencies
testKotlinScriptDefExtensions
No dependencies
testRuntimeClasspath - Runtime classpath of compilation 'test' (target (jvm)).
+--- libraryA:libraryA:unspecified
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| | \--- org.jetbrains:annotations:13.0
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (*)
+--- org.jetbrains.kotlin:kotlin-test:1.3.31
| +--- org.jetbrains.kotlin:kotlin-test-common:1.3.31
| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
\--- org.jetbrains.kotlin:kotlin-test-junit:1.3.31
+--- org.jetbrains.kotlin:kotlin-test-annotations-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
+--- org.jetbrains.kotlin:kotlin-test:1.3.31 (*)
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
testRuntimeOnly - Runtime only dependencies for compilation 'test' (target (jvm)). (n)
No dependencies
testRuntimeOnlyDependenciesMetadata
No dependencies
(*) - dependencies omitted (listed previously)
(n) - Not resolved (configuration is not meant to be resolved)
A web-based, searchable dependency report is available by adding the --scan option.
BUILD SUCCESSFUL in 604ms
1 actionable task: 1 executed
Now with libraryA having an implementation dependency on libraryB:
> Task :dependencies
------------------------------------------------------------
Root project
------------------------------------------------------------
-api (n)
No dependencies
-runtime (n)
+--- libraryA:libraryA:unspecified (n)
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (n)
annotationProcessor - Annotation processors and their dependencies for source set 'main'.
No dependencies
api - API dependencies for compilation 'main' (target (jvm)). (n)
No dependencies
apiDependenciesMetadata
No dependencies
apiElements - API elements for main. (n)
No dependencies
archives - Configuration for archive artifacts.
No dependencies
compileClasspath - Compile classpath for compilation 'main' (target (jvm)).
+--- libraryA:libraryA:unspecified
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains:annotations:13.0
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
\--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
compileOnly - Compile only dependencies for compilation 'main' (target (jvm)). (n)
No dependencies
compileOnlyDependenciesMetadata
No dependencies
default - Configuration for default artifacts.
+--- libraryA:libraryA:unspecified
| +--- libraryB:libraryB:unspecified
| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| | | \--- org.jetbrains:annotations:13.0
| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (*)
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (*)
implementation - Implementation only dependencies for compilation 'main' (target (jvm)). (n)
+--- libraryA:libraryA:unspecified (n)
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (n)
implementationDependenciesMetadata
+--- libraryA:libraryA:unspecified
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains:annotations:13.0
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
\--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
kotlinCompilerClasspath
\--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.31
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains:annotations:13.0
+--- org.jetbrains.kotlin:kotlin-script-runtime:1.3.31
+--- org.jetbrains.kotlin:kotlin-reflect:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
\--- org.jetbrains.intellij.deps:trove4j:1.0.20181211
kotlinCompilerPluginClasspath
\--- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.3.31
kotlinNativeCompilerPluginClasspath
No dependencies
kotlinScriptDef - Script filename extensions discovery classpath configuration
No dependencies
kotlinScriptDefExtensions
No dependencies
runtimeClasspath - Runtime classpath of compilation 'main' (target (jvm)).
+--- libraryA:libraryA:unspecified
| +--- libraryB:libraryB:unspecified
| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| | | \--- org.jetbrains:annotations:13.0
| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (*)
\--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (*)
runtimeElements - Elements of runtime for main. (n)
No dependencies
runtimeOnly - Runtime only dependencies for compilation 'main' (target (jvm)). (n)
No dependencies
runtimeOnlyDependenciesMetadata
No dependencies
sourceArtifacts (n)
No dependencies
testAnnotationProcessor - Annotation processors and their dependencies for source set 'test'.
No dependencies
testApi - API dependencies for compilation 'test' (target (jvm)). (n)
No dependencies
testApiDependenciesMetadata
No dependencies
testCompileClasspath - Compile classpath for compilation 'test' (target (jvm)).
+--- libraryA:libraryA:unspecified
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| | \--- org.jetbrains:annotations:13.0
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
+--- org.jetbrains.kotlin:kotlin-test:1.3.31
| +--- org.jetbrains.kotlin:kotlin-test-common:1.3.31
| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
\--- org.jetbrains.kotlin:kotlin-test-junit:1.3.31
+--- org.jetbrains.kotlin:kotlin-test-annotations-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
+--- org.jetbrains.kotlin:kotlin-test:1.3.31 (*)
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
testCompileOnly - Compile only dependencies for compilation 'test' (target (jvm)). (n)
No dependencies
testCompileOnlyDependenciesMetadata
No dependencies
testImplementation - Implementation only dependencies for compilation 'test' (target (jvm)). (n)
+--- org.jetbrains.kotlin:kotlin-test:1.3.31 (n)
\--- org.jetbrains.kotlin:kotlin-test-junit:1.3.31 (n)
testImplementationDependenciesMetadata
+--- libraryA:libraryA:unspecified
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| | \--- org.jetbrains:annotations:13.0
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
+--- org.jetbrains.kotlin:kotlin-test:1.3.31
| +--- org.jetbrains.kotlin:kotlin-test-common:1.3.31
| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
\--- org.jetbrains.kotlin:kotlin-test-junit:1.3.31
+--- org.jetbrains.kotlin:kotlin-test-annotations-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
+--- org.jetbrains.kotlin:kotlin-test:1.3.31 (*)
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
testKotlinScriptDef - Script filename extensions discovery classpath configuration
No dependencies
testKotlinScriptDefExtensions
No dependencies
testRuntimeClasspath - Runtime classpath of compilation 'test' (target (jvm)).
+--- libraryA:libraryA:unspecified
| +--- libraryB:libraryB:unspecified
| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31
| | +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31
| | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| | | \--- org.jetbrains:annotations:13.0
| | \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.31
| | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (*)
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31 (*)
+--- org.jetbrains.kotlin:kotlin-test:1.3.31
| +--- org.jetbrains.kotlin:kotlin-test-common:1.3.31
| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 (*)
\--- org.jetbrains.kotlin:kotlin-test-junit:1.3.31
+--- org.jetbrains.kotlin:kotlin-test-annotations-common:1.3.31
| \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31
+--- org.jetbrains.kotlin:kotlin-test:1.3.31 (*)
\--- junit:junit:4.12
\--- org.hamcrest:hamcrest-core:1.3
testRuntimeOnly - Runtime only dependencies for compilation 'test' (target (jvm)). (n)
No dependencies
testRuntimeOnlyDependenciesMetadata
No dependencies
(*) - dependencies omitted (listed previously)
(n) - Not resolved (configuration is not meant to be resolved)
A web-based, searchable dependency report is available by adding the --scan option.
BUILD SUCCESSFUL in 564ms
1 actionable task: 1 executed
Note I am using version 6.2.2
So my problem was that I wasn't enabling the java-library plugin. Once I added that to libraryA, libraryB successfully appeared on the compileClasspath of consumer.
So the correct build.gradle.kts for libraryA is:
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Kotlin library project to get you started.
*/
plugins {
maven
`java-library`
id("org.jetbrains.kotlin.jvm").version("1.3.31")
}
group = "libraryA"
repositories {
mavenLocal()
jcenter()
}
dependencies {
api("libraryB:libraryB:unspecified")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
// Use the Kotlin JUnit integration.
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}

Copying folder contents preserving the folder structure using powershell script

I have the source folder structure as shown below
c:\TestResults
|-- Log
| |-- xyz.pdf
| `-- Reports
| `-- rp.pdf
|-- Keywords
| |-- key.txt
| | `-- pb.ea
| `-- reports
|-- Test
| |-- 11.pdf
| |-- 12
| `-- Log
| |-- h1.pdf
| `-- Reports
| `-- h2.pdf
`-- Dev
|-- st
|-- ea
`-- Log
`-- Reports
`-- h4.pdf
I need to copy all the "Log" folders while maintaining the folder structure. The destination path is "c:\Work\Logs\TestResults". The resultant structure should be as shown below.
c:\Work\Logs\TestResults
|-- Log
| |-- xyz.pdf
| `-- Reports
| `-- rp.pdf
|-- Test
| `-- Log
| |-- h1.pdf
| `-- Reports
| `-- h2.pdf
`-- Dev
`-- Log
`-- Reports
`-- h4.pdf
Is there an easy way of achieving this using a powershell script? Thanks!
Edit: Here's the code that I have written so far. It flattens the folder structure but doesn't maintain the hierarchy. I am new to powershell scripting. Please help.
$baseDir = "c:\TestResults"
$outputDir = "c:\Work\Logs"
$outputLogsDir = $outputDir + "\TestResults"
$nameToFind = "Log"
$paths = Get-ChildItem $baseDir -Recurse | Where-Object { $_.PSIsContainer -and $_.Name.EndsWith($nameToFind)}
if(!(test-path $outputLogsDir))
{
New-Item -ItemType Directory -Force -Path $outputLogsDir
}
foreach($path in $paths)
{
$sourcePath = $path.FullName + "\*"
Get-ChildItem -Path $sourcePath | Copy-Item -Destination $outputLogsDir -Recurse -Container
}
What you are after is as below. it will copy the item and dir if any part of it has "\log" in it.
$gci = Get-ChildItem -Path "C:\TestResults" -Recurse
Foreach($item in $gci){
If($item.FullName -like "*\log*"){
Copy-Item -Path $item.FullName -Destination $($item.FullName.Replace("C:\TestResults","C:\Work\Logs\TestResults")) -Force
}
}

How to exclude a package from a transitive dependency of external jar included in build.gradle?

I have included the following dependency in my build.gradle:
testCompile group: 'com.xebialabs.restito', name: 'restito', version:'0.5.1'
But with this jar other dependencies like jersey-core-1.18.3.jar also get included.
Now I want this jersey jar but this also has a package javax.ws.rs.core which contains classes that conflict with my latest version of javax.ws.rs.core included explicitly in build.gradle.
Is there any way that I can exclude only a specific package from a transitive dependency and not the whole dependency. I am a newbie to gradle so please correct me if any incorrect term was used.
When I run the following command:
gradlew dependencies --configuration testCompile
it gives me following dependency tree. Only the relevant part is shown here
testCompile - Compile classpath for source set 'test'.
+--- org.apache.cxf:cxf-rt-frontend-jaxrs:3.0.3
| +--- org.apache.cxf:cxf-core:3.0.3 (*)
| +--- javax.ws.rs:javax.ws.rs-api:2.0.1
| +--- javax.annotation:javax.annotation-api:1.2
| \--- org.apache.cxf:cxf-rt-transports-http:3.0.3 (*)
+--- org.apache.cxf:cxf-rt-rs-service-description:3.0.0-milestone1
| \--- org.apache.cxf:cxf-rt-frontend-jaxrs:3.0.0-milestone1 -> 3.0.3 (*)
+--- org.codehaus.jackson:jackson-jaxrs:1.9.13
| +--- org.codehaus.jackson:jackson-core-asl:1.9.13
| \--- org.codehaus.jackson:jackson-mapper-asl:1.9.13
| \--- org.codehaus.jackson:jackson-core-asl:1.9.13
+--- org.codehaus.jackson:jackson-mapper-asl:1.9.12 -> 1.9.13 (*)
+--- com.fasterxml.jackson.core:jackson-databind:2.4.1.2
| +--- com.fasterxml.jackson.core:jackson-annotations:2.4.0
| \--- com.fasterxml.jackson.core:jackson-core:2.4.1.1
\--- com.xebialabs.restito:restito:0.5.1
+--- org.slf4j:slf4j-api:1.7.5 -> 1.7.7
+--- org.mockito:mockito-core:1.10.17
| +--- org.hamcrest:hamcrest-core:1.1 -> 1.3
| \--- org.objenesis:objenesis:2.1
+--- org.apache.mina:mina-core:2.0.4
| \--- org.slf4j:slf4j-api:1.6.1 -> 1.7.7
+--- org.glassfish.grizzly:grizzly-http-server:2.3.17
| \--- org.glassfish.grizzly:grizzly-http:2.3.17
| \--- org.glassfish.grizzly:grizzly-framework:2.3.17
+--- junit:junit:4.12
| \--- org.hamcrest:hamcrest-core:1.3
\--- com.sun.jersey:jersey-grizzly2:1.18.3
+--- org.glassfish.grizzly:grizzly-http:2.2.16 -> 2.3.17 (*)
+--- org.glassfish.grizzly:grizzly-http-server:2.2.16 -> 2.3.17 (*)
\--- com.sun.jersey:jersey-server:1.18.3
\--- com.sun.jersey:jersey-core:1.18.3
(*) - dependencies omitted (listed previously)
Now the class Response in javax.ws.rs:javax.ws.rs-api:2.0.1 is under the package javax.ws.rs.core. Similarly there is another Response class present in com.sun.jersey:jersey-core:1.18.3 in package javax.ws.rs.core. But the later one contains earlier version which does not has readEntity() method introduced in rs-api 2.0. The dependency for Response in my project gets resolved to the earlier version always.
Citing gradle user guide section about Excluding transitive dependencies:
You can exclude a transitive dependency either by configuration or by dependency:
Example 50.14
configurations {
compile.exclude module: 'commons'
all*.exclude group: 'org.gradle.test.excludes', module: 'reports'
}
dependencies {
compile("org.gradle.test.excludes:api:1.0") {
exclude module: 'shared'
}
}
So back to your case, you can simply just take one of the methods described above and replace the modules in the example with with the module you'd like to exclude, e.g.
configurations {
testCompile.exclude group: 'javax.ws.rs', module: 'jsr311-api'
}
Update (per the additional details provided)
What you have to do is to add to your script the following lines
configurations {
testCompile.exclude group: 'com.sun.jersey', module: 'jersey-core'
}
Consider the following minimal build.gradle script:
apply plugin: 'java'
repositories {
mavenCentral()
}
configurations {
// Excluding com.sun.jersey:jersey-core:1.18.3, option #1:
// compile.exclude group: 'com.sun.jersey', module: 'jersey-core'
}
dependencies {
compile "org.apache.cxf:cxf-rt-frontend-jaxrs:3.0.3"
compile ("com.sun.jersey:jersey-grizzly2:1.18.3") {
// Excluding com.sun.jersey:jersey-core:1.18.3, option #2:
// exclude group: 'com.sun.jersey', module: 'jersey-core'
}
}
Now, with the file above as is running gradlew dependencies --configuration testCompile you'll get the next dependency tree:
+--- org.apache.cxf:cxf-rt-frontend-jaxrs:3.0.3
| +--- org.apache.cxf:cxf-core:3.0.3
| | +--- org.codehaus.woodstox:woodstox-core-asl:4.4.1
| | | \--- org.codehaus.woodstox:stax2-api:3.1.4
| | \--- org.apache.ws.xmlschema:xmlschema-core:2.1.0
| +--- javax.ws.rs:javax.ws.rs-api:2.0.1
| +--- javax.annotation:javax.annotation-api:1.2
| \--- org.apache.cxf:cxf-rt-transports-http:3.0.3
| \--- org.apache.cxf:cxf-core:3.0.3 (*)
\--- com.sun.jersey:jersey-grizzly2:1.18.3
+--- org.glassfish.grizzly:grizzly-http:2.2.16
| \--- org.glassfish.grizzly:grizzly-framework:2.2.16
+--- org.glassfish.grizzly:grizzly-http-server:2.2.16
| +--- org.glassfish.grizzly:grizzly-http:2.2.16 (*)
| \--- org.glassfish.grizzly:grizzly-rcm:2.2.16
| \--- org.glassfish.grizzly:grizzly-framework:2.2.16
\--- com.sun.jersey:jersey-server:1.18.3
\--- com.sun.jersey:jersey-core:1.18.3
Note that com.sun.jersey:jersey-core:1.18.3 is listed as a transitive dependency. Now, uncommenting either of the exclusion options and rerunning the same command you'll get the following output which does contain this module:
+--- org.apache.cxf:cxf-rt-frontend-jaxrs:3.0.3
| +--- org.apache.cxf:cxf-core:3.0.3
| | +--- org.codehaus.woodstox:woodstox-core-asl:4.4.1
| | | \--- org.codehaus.woodstox:stax2-api:3.1.4
| | \--- org.apache.ws.xmlschema:xmlschema-core:2.1.0
| +--- javax.ws.rs:javax.ws.rs-api:2.0.1
| +--- javax.annotation:javax.annotation-api:1.2
| \--- org.apache.cxf:cxf-rt-transports-http:3.0.3
| \--- org.apache.cxf:cxf-core:3.0.3 (*)
\--- com.sun.jersey:jersey-grizzly2:1.18.3
+--- org.glassfish.grizzly:grizzly-http:2.2.16
| \--- org.glassfish.grizzly:grizzly-framework:2.2.16
+--- org.glassfish.grizzly:grizzly-http-server:2.2.16
| +--- org.glassfish.grizzly:grizzly-http:2.2.16 (*)
| \--- org.glassfish.grizzly:grizzly-rcm:2.2.16
| \--- org.glassfish.grizzly:grizzly-framework:2.2.16
\--- com.sun.jersey:jersey-server:1.18.3

How can I get list of open tabs in Firefox via a command-line application?

I have a lot of tabs open in Firefox. After I close Firefox and then run it again, the tabs are there. That's all right.
However, from time to time, Firefox crashes and my tabs are lost. How do I get the open tabs and backup the list to some file?
(With tabs in a file, I can also use Git, SVN, or whatever to store them and optionally find some link 'that I saw in my browser but can't remember what it was'.)
What I got so far:
I'm able to get some URLs, but that's doesn't seem to be exactly what I see in Firefox:
$c = ((gc c:\Users\..\AppData\Roaming\Mozilla\Firefox\Profiles\xfvj8vd5.default\sessionstore.js ) -join '')
$sess = [Jayrock.Json.Conversion.JsonConvert]::Import( $c.trim('()') )
$sess.windows[0].tabs |
% { $_.entries } |
% { $_.url } |
Select-Object -Unique
Please, don't tell me "use this addon or that addon". I really would like do it as I described.
Using the JSON module from PoshCode, this looks right (bear in mind: I tested this on Firefox 4, where the Tab Panorama results in "hidden" tabs, ymmv).
ConvertFrom-Json -File ~\AppData\R*\M*\F*\P*\*\sessionstore.js -Type PSObject -EA 0 |
Select -Expand Windows | Select -Expand Tabs |
Where { !$_.hidden } | ForEach { #($_.Entries)[-1] } |
Select Title, Url
All the * in the first line are just to make it short. Feel free to expand that to the full path if you care about the (milli)seconds spent searching.
I'd recommend using brotab to get the URLs of all open tabs:
pip install brotab
brotab install
Install the web extension as well: https://addons.mozilla.org/en-US/firefox/addon/brotab/
Restart Firefox, and you can use brotab list and parse it as so:
bt list | awk -F'\t' '{
print $2
}' > urls-backup.txt
Then open all URLs in urls-backup.txt with normal Firefox:
while read url; do
firefox "$url"
done < urls-backup.txt
not in PowerShell but I recently faced this problem so maybe this onliner can help someone:
cat recovery.js | sed 's#{"url":"#\n\n#g' | cut -d'"' -f1 | grep . | sort -u
#Test in Firefox 5.0
$sessionStoreFile = "$env:APPDATA\Mozilla\Firefox\Profiles\*.default\sessionstore-backups\recovery.js"
$sessionStoreFileExists = Test-Path $sessionStoreFile
If($sessionStoreFileExists -eq $False) {
#Test in Firefox 2.0, 3.0 and 4.0
$sessionStoreFile = "$env:APPDATA\Mozilla\Firefox\Profiles\*.default\sessionstore.js"
}
(Get-Content -Encoding UTF8 -Raw -Path $sessionStoreFile).Trim('()') | ConvertFrom-Json |
Select -Expand Windows | Select -Expand Tabs |
Where { !$_.hidden } | ForEach { #($_.Entries)[-1] } |
Select Url, Title | Export-Csv -Path $CsvFile -Encoding UTF8 -NoTypeInformation
You can download detail SQL script from how to export all URLs of Firefox tabs at once(PowerShell)

Resources