#Troubleshooting logback.xml dependency issue

1 messages ยท Page 1 of 1 (latest)

mint aspenBOT
#

@signal linden has a question:

imakerobots

I have Makelangelo which depends on Donatello which depends on Nodegraphcore. All three use slf4j+logback. when i mvn:package makelangelo and open the fat jar I see that the logback.xml is from donatello. I tried modifiying assembly plugin to exclude all logback.xml files, didn't help.

#

<@&987246399047479336> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question ๐Ÿค–. Maybe it helps! In any case, a human is on the way ๐Ÿ‘. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
I have Makelangelo which depends on Donatello which depends on Nodegraphcore. All three use slf4j+logback. when i mvn:package makelangelo and open the fat jar I see that the logback.xml is from donatello. I tried modifiying assembly plugin to exclude al

It seems like there may be a conflict with the logback.xml configuration when packaging Makelangelo. You can try excluding the logback.xml from Donatello's dependency in your pom.xml file or explicitly specify the logback.xml location in Makelangelo's configuration.

<dependency>
    <groupId>com.example</groupId>
    <artifactId>donatello</artifactId>
    <version>1.0</version>
    <exclusions>
        <exclusion>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </exclusion>
    </exclusions>
</dependency>

Alternatively, you can check if the classpath is correctly configured to prioritize Makelangelo's logback.xml over Donatello's.

Useful links:

obsidian bobcat
#

I tried modifiying assembly plugin to exclude all logback.xml files, didn't help.

#

hm

#

can you share your final assembly plugin config

#

that should work

#

there is a seperate conversation about whether you should have something like donatello and dontatello-core (where the -core or whatever is the eventually included library)

signal linden
#
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
    <id>with-dependencies</id>
    <includeBaseDirectory>false</includeBaseDirectory>
    <formats>
        <format>jar</format>
    </formats>
    <dependencySets>
        <!-- Unpack everything -->
        <dependencySet>
            <outputDirectory>/</outputDirectory>
            <useProjectArtifact>true</useProjectArtifact>
            <scope>runtime</scope>
            <unpack>true</unpack>
            <excludes>
                <exclude>**/logback.xml</exclude>
            </excludes>
        </dependencySet>
    </dependencySets>
    <containerDescriptorHandlers>
        <containerDescriptorHandler>
            <handlerName>metaInf-services</handlerName>
        </containerDescriptorHandler>
    </containerDescriptorHandlers>

</assembly>```
#

that's the assembly.xml

obsidian bobcat
#

add

#
            <excludes>
                <exclude>logback.xml</exclude>
                <exclude>**/logback.xml</exclude>
            </excludes>
#

see if that does anything

signal linden
#

here's the plugin:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
        <archive>
            <manifestEntries>
                <SplashScreen-Image>splash.png</SplashScreen-Image>
            </manifestEntries>
            <manifest>
                <mainClass>com.marginallyclever.makelangelo.Makelangelo</mainClass>
                <addClasspath>true</addClasspath>
            </manifest>
        </archive>
        <descriptors>
            <descriptor>${project.basedir}/src/main/assembly/application.xml</descriptor>
        </descriptors>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <!-- this is used for inheritance merges -->
            <phase>package</phase>
            <!-- bind to the packaging phase -->
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>
obsidian bobcat
#

also maybe add -X too to make sure the assembly thing is actually getting run

signal linden
#

add to what?

#

I run maven:package from intellij

#

after a clean.

#

i see the jar is removed and re-created.

#

I added your line to the assembly and it's still happening.

#

the basic jar is correct, the jar with-dependencies is wrong.

#

hm.

#

so it's probably the maven-resources-plugin that's the culprit

#

now i tried xml <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.3.1</version> <executions> <execution> <id>copy-fat-jar</id> <phase>package</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target/package</outputDirectory> <resources> <resource> <directory>target</directory> <includes> <include>Makelangelo*-with-dependencies.jar</include> </includes> <excludes> <exclude>**/logback.xml</exclude> <exclude>logback.xml</exclude> </excludes> <filtering>false</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin>

#

still happening ๐Ÿ˜ฆ

obsidian bobcat
#

So

#

mvn -X package

#

Also is this still 3 separate maven projects?

#

(it's not too important, I'm just gauging how annoying it would be to run locally)

signal linden
#

yes, it is.

#

so the fix appears to be xml <fileSets> <fileSet> <directory>src/main/resources</directory> <outputDirectory>/</outputDirectory> <includes> <include>logback.xml</include> </includes> </fileSet> </fileSets>

mint aspenBOT
#

@signal linden

Your question has been closed due to inactivity.

If it was not resolved yet, feel free to just post a message below
to reopen it, or create a new thread.

Note that usually the reason for nobody calling back is that your
question may have been not well asked and hence no one felt confident
enough answering.

When you reopen the thread, try to use your time to improve the quality
of the question by elaborating, providing details, context, all relevant code
snippets, any errors you are getting, concrete examples and perhaps also some
screenshots. Share your attempt, explain the expected results and compare
them to the current results.

Also try to make the information easily accessible by sharing code
or assignment descriptions directly on Discord, not behind a link or
PDF-file; provide some guidance for long code snippets and ensure
the code is well formatted and has syntax highlighting. Kindly read through
https://stackoverflow.com/help/how-to-ask for more.

With enough info, someone knows the answer for sure ๐Ÿ‘

signal linden
#

@obsidian bobcat thanks for the help! ๐Ÿ™‚

hexed canyon
#

also file a ticket with donatello to not depend on a runtime implementation of slf4j

hexed canyon
#

ah, yeah unless it has a main it should not depend on logback-classic

obsidian bobcat
#

it does have a main

hexed canyon
#

"which depends on Donatello", dependencies should not have a main lol

#

anyway, then my advice is moot

#

bye

obsidian bobcat
#

#1395122893205012501 message