In my previous comment I wrote about my compile problems and problems with unit tests.
I got these resolved, but now I am having OSGI problems:
IT WORKS, but Am I doing it right? I basically only want to use the http client and slf4j logging
=> This pulls in so many “optional” dependencies, that I do not know if this is correct now. Or if I am missing some compile time dependency.
The following setup works and I can run my app, but whatever I do I cannot get my logging working. It just logs nothing, regardless the log level.
pom.xml => dependencies*
...
<!-- CONFLUENCE 9 START -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.0.0-jre</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.16.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.15.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.14.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.16.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.16.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.16.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.16.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.16.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.3.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.22.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.22.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.22.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.22.1</version>
<scope>compile</scope>
</dependency>
<!-- CONFLUENCE 9 END -->
...
pom.xml => excludes and OSGI Imports
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>confluence-maven-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<banningExcludes>
<exclude>com.google.code.findbugs:jsr305</exclude>
<exclude>com.google.guava:guava</exclude>
<exclude>commons-io:commons-io</exclude>
<exclude>org.apache.commons:commons-lang3</exclude>
<exclude>org.slf4j:slf4j-api</exclude>
<exclude>org.apache.httpcomponents:httpclient</exclude>
<exclude>org.apache.httpcomponents:httpcore</exclude>
</banningExcludes>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<Export-Package />
<Import-Package>
com.atlassian.sal.*,
!com.google.gson.*,
!com.google.guava.*,
!org.apache.commons.codec.binary.*,
!org.apache.commons.io.*,
!org.apache.commons.lang3.*,
!org.apache.http.*,
!org.codehaus.jackson.*,
!org.apache.commons.logging.*,
!org.apache.log.*,
!org.apache.logging.*,
!org.slf4j.*,
javax.jms;resolution:=optional,
javax.script;resolution:=optional,
javax.sql;resolution:=optional,
javax.swing.text;resolution:=optional,
javax.tools;resolution:=optional,
javax.transaction.xa;resolution:=optional,
org.apache.avalon.framework.logger;resolution:=optional,
org.apache.commons.compress.*;resolution:=optional,
org.apache.commons.csv.*;resolution:=optional,
org.apache.kafka.*;resolution:=optional,
org.brotli.dec.*;resolution:=optional,
org.conscrypt.*;resolution:=optional,
com.conversantmedia.util.concurrent.*;resolution:=optional,
com.lmax.disruptor.*;resolution:=optional,
org.fusesource.*;resolution:=optional,
org.ietf.jgss.*;resolution:=optional,
org.jctools.queues.*;resolution:=optional,
org.zeromq.*;resolution:=optional,
*
</Import-Package>
<Spring-Context>*</Spring-Context>
</instructions>
<allowGoogleTracking>false</allowGoogleTracking>
<productVersion>${confluence.version}</productVersion>
<productDataVersion>${confluence.data.version}</productDataVersion>
<compressJs>false</compressJs>
<compressCss>false</compressCss>
<compressResources>false</compressResources>
<skipManifestValidation>true</skipManifestValidation>
<enableQuickReload>true</enableQuickReload>
</configuration>
</plugin>
pom.xml => config
<confluence.version>9.0.0-m08</confluence.version>
<confluence.data.version>9.0.0-m08</confluence.data.version>
<amps.version>8.13.0</amps.version>
<plugin.testrunner.version>2.0.1</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.1.10</atlassian.spring.scanner.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
QUESTION: Is this “correct”? The official docs on logging and it only says to use slf4j (which I do):
private static final Logger log = LoggerFactory.getLogger(TheCurrentClass.class);
I can see my log entries in the log file. Just want someone to confirm my setup, thanks