Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the Shade Plugin version #6

Open
feinstein opened this issue Dec 12, 2017 · 11 comments
Open

Update the Shade Plugin version #6

feinstein opened this issue Dec 12, 2017 · 11 comments

Comments

@feinstein
Copy link

Right now the Maven shade plugin version is at 3.1.0 and your library's compatibility is at 2.4.3.
Please update the library to the latest Maven shade plugin version.

@paulosuzart
Copy link

paulosuzart commented May 10, 2018

I get

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade (default) 
on project syi-platform: Unable to parse configuration of mojo org.apache.maven.plugins:maven-shade-plugin:3.1.0:shade for parameter resource: Cannot find 'resource' in class 
com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer -> [Help 1]

Using whatever version of shade. Not sure if it is related. Any ideas?

@PyvesB
Copy link

PyvesB commented May 24, 2018

@paulosuzart what does you pom.xml look like?

@mrosner17
Copy link

@PyvesB I think I am seeing the same issue as paulosuzart.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.4.3:shade (default) on project promoscombos: Unable to parse configuration of mojo org.apache.maven.plugins:maven-shade-plugin:2.4.3:shade for parameter resource: Cannot find 'resource' in class com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer -> [Help 1]
Here is what I have in my pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<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>
	<dependency>
		<groupId>com.amazonaws</groupId>
		<artifactId>aws-lambda-java-log4j2</artifactId>
		<version>1.0.0</version>
	</dependency>
	<dependency>
		<groupId>org.apache.logging.log4j</groupId>
		<artifactId>log4j-api</artifactId>
		<version>2.8.1</version>
	</dependency>
	<dependency>
		<groupId>org.apache.logging.log4j</groupId>
		<artifactId>log4j-core</artifactId>
		<version>2.8.1</version>
	</dependency>

      <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.4.3</version>
            <configuration>
                <createDependencyReducedPom>false</createDependencyReducedPom>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                    	<transformers>
				            <transformer implementation="com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer">
				            </transformer>
				          </transformers>
                        <artifactSet>
                            <excludes>
                                <exclude>org.apache.tomcat.embed:*</exclude>
                            </excludes>      
                        </artifactSet>
                    </configuration>
                    
                </execution>
            </executions>
            <dependencies>
		      <dependency>
		        <groupId>com.github.edwgiz</groupId>
		        <artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
		        <version>2.8.1</version>
		      </dependency>
		    </dependencies>
        </plugin>
    </plugins>

@ncremaschini
Copy link

updates about this?

@mrosner17
Copy link

mrosner17 commented Aug 14, 2018

I got around it by using SLF4J. Still have bugs, but at least I am getting something to log to Cloudwatch.

@nmichalares
Copy link

nmichalares commented Nov 27, 2018

May not be the right spot for this, but I was led here with the same error as what's mentioned above:
Unable to parse configuration of mojo org.apache.maven.plugins:maven-shade-plugin:3.2.0:shade for parameter resource: Cannot find 'resource' in class com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer

I am seeing this error pop up when I bring in spring boot parent.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.0.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

<dependencies>
    <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-lambda-java-log4j2</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-function-adapter-aws</artifactId>
            <version>2.0.0.BUILD-SNAPSHOT</version>
        </dependency>
    </dependencies>
<dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-function-dependencies</artifactId>
                <version>2.0.0.BUILD-SNAPSHOT</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

<build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <createDependencyReducedPom>false</createDependencyReducedPom>
                    <shadedArtifactAttached>true</shadedArtifactAttached>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <transformers>
                                <transformer
                                        implementation="com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer">
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>com.github.edwgiz</groupId>
                        <artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId>
                        <version>2.8.1</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <mainClass>ACTUAL_MAIN_CLASS</mainClass>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.springframework.boot.experimental</groupId>
                        <artifactId>spring-boot-thin-layout</artifactId>
                        <version>1.0.17.RELEASE</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

@Ghilteras
Copy link

Got into this as well, looks like I cannot use aws-lambda-java-libs with shade

@MarkusKramer
Copy link

For me, the issue was caused by having a parent pom. Removing the parent solved it for me.

@NicholasPurdy
Copy link

@ncremaschini I too am trying to get the custom AWS lambda appender to work with Spring Boot. For now, I am using a Logback configuration that can log stack traces as a single CloudWatch event. You can find it on my GitHub page.

@vdsysvd
Copy link

vdsysvd commented Oct 11, 2021

I solved the same issue adding the id tag inside the execution section
<executions> <execution> <id>shade-jar</id> <phase>package</phase> <goals> <goal>shade</goal>....

@kkishoreathena
Copy link

@vdsysvd could you throw some light on why this worked?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests