Skip to content

Commit

Permalink
#621 provide property 'jqassistant.store.embedded.neo4j-version' (#623)
Browse files Browse the repository at this point in the history
  • Loading branch information
DirkMahler authored Aug 25, 2024
1 parent d55be4b commit a478ba2
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 30 deletions.
8 changes: 7 additions & 1 deletion cli/neo4jv4/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<name>jQAssistant Commandline Neo4j 4.x Distribution</name>

<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -88,4 +94,4 @@
</dependency>
</dependencies>

</project>
</project>
4 changes: 4 additions & 0 deletions cli/neo4jv4/src/main/resources/.jqassistant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jqassistant:
store:
embedded:
neo4j-version: ${neo4j_4x.version}
8 changes: 7 additions & 1 deletion cli/neo4jv5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<name>jQAssistant Commandline Neo4j 5.x Distribution</name>

<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -88,4 +94,4 @@
</dependency>
</dependencies>

</project>
</project>
4 changes: 4 additions & 0 deletions cli/neo4jv5/src/main/resources/.jqassistant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jqassistant:
store:
embedded:
neo4j-version: ${neo4j_5x.version}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ jqassistant:
- group-id: org.neo4j.procedure
artifact-id: apoc-core
classifier: core
version: @neo4j_5x_apoc.version@

version: ${jqassistant.store.embedded.neo4j-version}

Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,15 @@ private void logVersion(EmbeddedDatastore embeddedDatastore) {
@Override
protected void destroy() {
neo4jPluginDirectory.ifPresent(directory -> {
try {
FileUtils.deleteDirectory(directory);
} catch (IOException e) {
log.warn("Cannot delete Neo4j plugin directory {}.", directory);
// delete Neo4j plugin directory only if it has not been configured explicitly
if (embedded.neo4jPluginDirectory()
.isEmpty()) {
log.info("Removing Neo4j plugin directory {}.", directory);
try {
FileUtils.deleteDirectory(directory);
} catch (IOException e) {
log.warn("Cannot delete Neo4j plugin directory {}.", directory);
}
}
});
}
Expand Down
20 changes: 19 additions & 1 deletion manual/src/main/asciidoc/include/configuration.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,10 @@ The priorities are as following: `System Property` --> `Environment Variable` --

=== Property placeholders

Values may contain placeholders referering to other properties:
Values may contain placeholders referring to other properties:

[source,yaml]
..jqassistant.yml
----
src-dir: ./src
Expand All @@ -362,3 +363,20 @@ The properties in placeholders can be defined in different sources:
- environment variables
- Maven or user properties specified in the files pom.xml or settings.xml (for the jQAssistant Maven plugin)

[TIP]
====
The predefined property `jqassistant.store.embedded.neo4j-version` may be used to specify the version of the https://github.com/neo4j/apoc[APOC] plugin for the embedded store (Neo4j v5 only):
[source,yaml]
..jqassistant.yml
----
jqassistant:
store:
embedded:
neo4j-plugins:
- group-id: org.neo4j.procedure
artifact-id: apoc-core
classifier: core
version: ${jqassistant.store.embedded.neo4j-version}
----
====
29 changes: 21 additions & 8 deletions maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@
<settingsFile>src/it/settings.xml</settingsFile>
<pomIncludes>
<!-- Use -Dinvoker.test=<pattern> to override the configuration below on the commandline -->
<include>configuration/*/pom.xml</include>
<include>analyze/*/pom.xml</include>
<include>cli/*/pom.xml</include>
<include>singlemodule/*/pom.xml</include>
<include>multimodule/*/*/pom.xml</include>
<include>configuration/*/pom.xml</include>
<include>list-plugins/pom.xml</include>
<include>multimodule/*/*/pom.xml</include>
<include>neo4j-plugin/pom.xml</include>
<include>plugin/pom.xml</include>
<include>singlemodule/*/pom.xml</include>
<include>yaml/*/pom.xml</include>
</pomIncludes>
</configuration>
Expand All @@ -58,6 +60,22 @@
</profiles>

<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>.jqassistant.yml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
<excludes>
<exclude>.jqassistant.yml</exclude>
</excludes>
<filtering>false</filtering>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
Expand Down Expand Up @@ -159,11 +177,6 @@
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.17.1</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
10 changes: 10 additions & 0 deletions maven/src/it/neo4j-plugin/.jqassistant-neo4jv4.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
jqassistant:
analyze:
groups:
- it
store:
embedded:
neo4j-plugins:
- group-id: org.neo4j.procedure
artifact-id: apoc
version: ${neo4j_4x_apoc.version}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
jqassistant:
analyze:
groups:
- it
store:
embedded:
neo4j-plugins:
- group-id: org.neo4j.procedure
artifact-id: apoc-core
classifier: core
version: ${apoc.version}
analyze:
groups:
- it
version: ${jqassistant.store.embedded.neo4j-version}
2 changes: 1 addition & 1 deletion maven/src/it/neo4j-plugin/invoker.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
invoker.goals.1 = verify -e
invoker.goals.2 = verify -e -Djqassistant.store.embedded.neo4j-plugin-directory=target/jqassistant/plugins
invoker.goals.2 = verify -e -Djqassistant.store.embedded.neo4j-plugin-directory=target/jqassistant/store/plugins
28 changes: 25 additions & 3 deletions maven/src/it/neo4j-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>@project.groupId@</groupId>
Expand All @@ -9,7 +10,28 @@
<artifactId>@[email protected]</artifactId>

<properties>
<apoc.version>@neo4j_5x_apoc.version@</apoc.version>
<!-- referenced in .jqassistant-neo4jv4.yml -->
<neo4j_4x_apoc.version>@neo4j_4x_apoc.version@</neo4j_4x_apoc.version>
</properties>

</project>
<profiles>
<profile>
<id>neo4jv4</id>
<activation>
<jdk>11</jdk>
</activation>
<properties>
<jqassistant.configuration.locations>.jqassistant-neo4jv4.yml</jqassistant.configuration.locations>
</properties>
</profile>
<profile>
<id>neo4jv5</id>
<activation>
<jdk>[17,)</jdk>
</activation>
<properties>
<jqassistant.configuration.locations>.jqassistant-neo4jv5.yml</jqassistant.configuration.locations>
</properties>
</profile>
</profiles>
</project>
6 changes: 3 additions & 3 deletions maven/src/it/neo4j-plugin/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def itGroup = jqassistantReport.group.find { it.@id = 'it' }
def concept = itGroup.concept.find { it.@id == 'it:APOCHelp' }
assert concept.status == 'success'

def pluginDir = new File(basedir, 'target/jqassistant/plugins')
assert pluginDir.exists();
assert pluginDir.isDirectory();
def pluginDir = new File(basedir, 'target/jqassistant/store/plugins')
assert pluginDir.exists()
assert pluginDir.isDirectory()
4 changes: 4 additions & 0 deletions maven/src/main/resources/.jqassistant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
jqassistant:
store:
embedded:
neo4j-version: ${neo4j.version}
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
<neo4j_4x.version>4.4.36</neo4j_4x.version>
<neo4j_4x_apoc.version>4.4.0.29</neo4j_4x_apoc.version>
<neo4j_5x.version>5.23.0</neo4j_5x.version>
<neo4j_5x_apoc.version>${neo4j_5x.version}</neo4j_5x_apoc.version>
<!-- The actual Neo4j version is set using the neo4jv4/neo4jv5 profiles
This default setting is required by Jenkins for parsing the Maven model -->
<neo4j.version>${neo4j_4x.version}</neo4j.version>
Expand Down Expand Up @@ -173,7 +172,7 @@
<plugin>
<groupId>com.buschmais.jqassistant</groupId>
<artifactId>jqassistant-maven-plugin</artifactId>
<version>2.4.0</version>
<version>2.5.0-RC2</version>
<executions>
<execution>
<id>default</id>
Expand Down

0 comments on commit a478ba2

Please sign in to comment.