-
Notifications
You must be signed in to change notification settings - Fork 619
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
Packaging issue for adapter-aws #170
Comments
I tried to reproduce from the aws sample, but couldn't.
It gets merged into the final shaded I'm still not sure why it's not working out of the box though. |
Seems like probably a gradle issue. You don't need to build a thin jar for any of the features of the sample to work, so you can also work around it by not using the thin launcher. Can you post a sample in github please? |
@dsyer here is the link to my project. The 2 sub-projects i am building with the aws-adapter are The whole project is using
|
Indeed the thin jar is not required, i managed to have the same behaviour without the experimental thin jar plugin. I also managed to reproduce by adding the following dependency to the
However when i tried to reproduce on a sample project based on the aws sample i could not get the same broken behaviour, for some reason. |
Why did you do this? shadowJar {
classifier = 'aws'
dependencies {
exclude(dependency("org.springframework.cloud:spring-cloud-function-web:${springCloudFunctionVersion}"))
}
} Would it work if you just remove that exclusion? Gradle dependency management can be a bit confusing sometimes, especially for me (as a non Gradle user). |
It's in the sample, apparently because of this recommandation. I just tried changing the task to:
It yields the proper |
I'm still confused however as to why the sample has the thin jar plugin, along with this dependency exclusion for the shadowJar task, if none of it is actually required 😕 |
The thin launcher is a choice. You can make it or not, it's up to you, but the samples choose it, just to demonstrate that it is possible really. AWS only works with shaded jars, so you need the |
Some useful comments here: spring-projects/spring-boot#1828. |
Yeah this worked for me (I think). You should check it. import com.github.jengelman.gradle.plugins.shadow.transformers.*
...
shadowJar {
classifier = 'aws'
dependencies {
exclude(dependency("org.springframework.cloud:spring-cloud-function-web:${springCloudFunctionVersion}"))
}
mergeServiceFiles()
append 'META-INF/spring.handlers'
append 'META-INF/spring.schemas'
append 'META-INF/spring.tooling'
transform(PropertiesFileTransformer) {
paths = ['META-INF/spring.factories' ]
mergeStrategy = "append"
}
}
|
Wow, thanks @dsyer for the clarifications ! Your proposed solution is working great indeed, and the actual content of the I think without your suggested enhancement, it may all come down to the order of dependencies during as for what you get in the shaded jar, explaining the somehow random behaviour i was getting. |
it would be nice to upgrade the sample to use spring boot 2, the newer gradle plugin together with shadowJar prove to create a few problems which are not trivial to solve. |
I’m not a Gradle person. If someone wants to send a PR we can have a look. Please don’t comment on closed issues though. |
any sample maven pom? |
There's a sample here: https://github.com/spring-cloud/spring-cloud-function/tree/master/spring-cloud-function-samples/function-sample-aws. Please don't comment on closed issues. If you have usage questions try stack overflow or gitter. |
Ok, i made multiples test and same problems ... but now i can remove -snapshot from pom how convert then:
and ... be sure that FUNCTION_NAME environment var was deleted... run againg ... magic ! works! thank you |
Hi,
i know this is not exactly a spring-cloud-function issue, but definitely related.
I am trying to package a project using the aws adapter, following the sample provided.
For my first project it is working fine, but for the second one i have an issue with the generated jar.
The
spring.factories
file is missing theEnableAutoConfiguration
.Working project
spring.factories
content:Non-working project
spring.factories
content:I managed to narrow down the problem to one of the dependency used in the non-working project (by removing it, the generated
-aws.jar
has the correctspring.factories
file), which is:com.github.spring-data-dynamodb:spring-data-dynamodb:4.5.5
I tried to dig into the documentation of the spring-boot-thin-launcher, but i couldn't get my head around how it's working exactly, and what exactly is the problem with this dependency in the first place.
My guess is that some transitive dependency of
spring-data-dynamodb
is including some part of the spring core, which is messing up the thin jar layout.I am using
Gradle
, with abuild.gradle
that is greatly similar to the one in the aws sample.Any help is appreciated !
The text was updated successfully, but these errors were encountered: