JavaGradleWorkflow includes extraneous files if other archive artifacts are defined
Los mantenedores suelen responder en 10 días
@xujiantop-crypto ya está trabajando en esto.
Desde el 17/9/2026.
- #927 de @xujiantop-crypto — abierto
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 38/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- java
- Área
- build-system
Línea de trabajo
Comienza con aws_lambda_builders/workflows/java_gradle/resources/lambda-build-init.gradle, especialmente con la selección del artefacto de archivo y los pasos GradleBuild y CopyArtifacts de JavaGradleWorkflow. Reproduce el problema con los comandos documentados sam init, application-plugin edit, sam build y find. Se considera terminado cuando el build incluye las clases de la aplicación y los JARs de dependencias sin el directorio de distribución de la aplicación ni sus archivos innecesarios.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description:
In certain Gradle projects, running sam build may include files in the bundle that aren't needed.
This occurs because the logic for grabbing the project's jar is actually pulling the contents of all defined archive artifacts, some of which may be for other purposes entirely. In most cases, this doesn't "break" anything, but just increases the size of the deployment bundle silently.
One example of a situation that would cause this is a Java project with the built-in "application" plugin applied, which then produces additional zip and tar distribution artifacts.
One potential fix would be to change https://github.com/awslabs/aws-lambda-builders/blob/develop/aws_lambda_builders/workflows/java_gradle/resources/lambda-build-init.gradle#L27 from def artifactJars = t.project.configurations.archives.artifacts.files.files to def artifactJars = configurations.archives.artifacts.findAll { it.extension == 'jar' }*.file.
Steps to reproduce the issue:
- Run
sam init --runtime java8 --dependency-manager gradle --name gradlebuildtest - Run
cd gradlebuildtest/ - Run
sam build && find .aws-sam/build/HelloWorldFunction -type f(Expected result) - Remove the previous result:
rm -rf .aws-sam/ - Edit
HelloWorldFunction/build.gradleas follows- Add
id 'application'to thepluginsblock - Add
mainClassName = 'helloworld.App'(it's not actually executable yet, but that doesn't matter for demonstrating this behavior)
- Add
- Run
sam build && find .aws-sam/build/HelloWorldFunction -type f(Observed result) - Note that there is now an unnecessary
HelloWorldFunctiondirectory included.
Observed result:
mac-dcarr:gradlebuildtest dcarr$ sam build && find .aws-sam/build/HelloWorldFunction -type f
Building resource 'HelloWorldFunction'
Running JavaGradleWorkflow:GradleBuild
Running JavaGradleWorkflow:CopyArtifacts
Build Succeeded
Built Artifacts : .aws-sam/build
Built Template : .aws-sam/build/template.yaml
Commands you can use next
=========================
[*] Invoke Function: sam local invoke
[*] Package: sam package --s3-bucket <yourbucket>
.aws-sam/build/HelloWorldFunction/helloworld/GatewayResponse.class
.aws-sam/build/HelloWorldFunction/helloworld/App.class
.aws-sam/build/HelloWorldFunction/HelloWorldFunction/bin/HelloWorldFunction
.aws-sam/build/HelloWorldFunction/HelloWorldFunction/bin/HelloWorldFunction.bat
.aws-sam/build/HelloWorldFunction/HelloWorldFunction/lib/aws-lambda-java-core-1.2.0.jar
.aws-sam/build/HelloWorldFunction/HelloWorldFunction/lib/HelloWorldFunction.jar
.aws-sam/build/HelloWorldFunction/META-INF/MANIFEST.MF
.aws-sam/build/HelloWorldFunction/lib/aws-lambda-java-core-1.2.0.jar
mac-dcarr:gradlebuildtest dcarr$
Expected result:
mac-dcarr:gradlebuildtest dcarr$ sam build && find .aws-sam/build/HelloWorldFunction -type f
Building resource 'HelloWorldFunction'
Running JavaGradleWorkflow:GradleBuild
Running JavaGradleWorkflow:CopyArtifacts
Build Succeeded
Built Artifacts : .aws-sam/build
Built Template : .aws-sam/build/template.yaml
Commands you can use next
=========================
[*] Invoke Function: sam local invoke
[*] Package: sam package --s3-bucket <yourbucket>
.aws-sam/build/HelloWorldFunction/helloworld/GatewayResponse.class
.aws-sam/build/HelloWorldFunction/helloworld/App.class
.aws-sam/build/HelloWorldFunction/META-INF/MANIFEST.MF
.aws-sam/build/HelloWorldFunction/lib/aws-lambda-java-core-1.2.0.jar
mac-dcarr:gradlebuildtest dcarr$
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
Scripts were run on Mac OS X 10.14.6; SAM CLI, version 0.23.0.
- Lenguaje dominante
- Python
- Estrellas
- 381
- Forks
- 161
- Merge medio
- 9 d 8 h
- PR fusionados (30 d)
- 2
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de aws/aws-lambda-builders
-
python_uv: `UvConfig.compile_bytecode` is never passed to uv, so the option has no effectPosiblemente ocupada @xujiantop-crypto la tomó hace 25 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
aws/aws-lambda-builders#925 · 1 reacción ·
Los mantenedores suelen responder en 10 días
-
Bytecode compiled during build is always discarded at runtime: SAM packaging writes 1980 timestamps, so timestamp-based .pyc never validatePosiblemente ocupada @xujiantop-crypto la tomó hace 25 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 64/100
aws/aws-lambda-builders#924 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 10 días
-
Bug: PythonUvBuilder fails to build app with dependencies on editable installs in the workspacePosiblemente ocupada @noritada la tomó hace 94 días. Abiertostage/needs-triage
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
aws/aws-lambda-builders#892 ·
Los mantenedores suelen responder en 10 días
-
stage/needs-triage type/feature
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
aws/aws-lambda-builders#839 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 10 días
-
Feature request: Skip binary validation when builder is not used for any languageQuizá libre de nuevo @saketh-bandi la tomó hace 39 días y no hay ningún pull request abierto. Abiertoarea/build contributors/good-first-issue contributors/welcome type/feature
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
aws/aws-lambda-builders#831 · 3 comentarios ·
Los mantenedores suelen responder en 10 días
Todos los issues de aws/aws-lambda-builders
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
Status: Triage Type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
-
Objects.List treats versions=false (and similar flags) as truePosiblemente ocupada @andaaron la tomó hoy. Abiertopriority: p2 type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
googleapis/storage-testbench#829 ·
Los mantenedores suelen responder en 2 días
-
[Bug]: memory provider treats 1:1 DMs as shared surfaces, so DM turns never receive reviewed recordsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
rlaope/oh-my-hermes#2088 ·
Los mantenedores suelen responder en 1 día