JavaGradleWorkflow includes extraneous files if other archive artifacts are defined
Mantenedores costumam responder em até 6 dias
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 38/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Estagnada
- Stack de tecnologia
- java
- Domínio
- build-system
Direção de pesquisa
Comece por aws_lambda_builders/workflows/java_gradle/resources/lambda-build-init.gradle, especialmente pela seleção do artefato do arquivo e pelas etapas GradleBuild e CopyArtifacts de JavaGradleWorkflow. Reproduza o problema com os comandos documentados sam init, application-plugin edit, sam build e find. Está concluído quando o build incluir as classes da aplicação e os JARs de dependências sem o diretório desnecessário de distribuição da aplicação e seus arquivos.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- Python
- Estrelas
- 381
- Forks
- 161
- Merge médio
- 5d 14h
- PRs com merge (30d)
- 3
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de aws/aws-lambda-builders
-
Bug: PythonUvBuilder resolves local requirements from the caller directoryTalvez já em andamento @vinsymoyya assumiu há 1 dia. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
aws/aws-lambda-builders#952 · 1 comentário ·
Mantenedores costumam responder em até 6 dias
-
python_uv: `UvConfig.compile_bytecode` is never passed to uv, so the option has no effectTalvez já em andamento @xujiantop-crypto assumiu há 51 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
aws/aws-lambda-builders#925 · 1 reação ·
Mantenedores costumam responder em até 6 dias
-
Bytecode compiled during build is always discarded at runtime: SAM packaging writes 1980 timestamps, so timestamp-based .pyc never validateTalvez já em andamento @xujiantop-crypto assumiu há 51 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 64/100
aws/aws-lambda-builders#924 · 1 comentário · 1 reação ·
Mantenedores costumam responder em até 6 dias
-
Bug: PythonUvBuilder fails to build app with dependencies on editable installs in the workspaceTalvez já em andamento @noritada assumiu há 119 dias. Abertastage/needs-triage
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 25/100
aws/aws-lambda-builders#892 ·
Mantenedores costumam responder em até 6 dias
-
Feature request: Add native uv support and configurationTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertastage/needs-triage type/feature
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 38/100
aws/aws-lambda-builders#839 · 3 comentários · 1 reação ·
Mantenedores costumam responder em até 6 dias
Todas as issues de aws/aws-lambda-builders
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 64/100
FinanceFlash/unvibecode#577 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
area/test type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Clodmony/starship-coop#70 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
punitarani/fli#270 ·
-
🐛 Bug 🔔 Pending processing
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 67/100
jumpserver/jumpserver#17980 ·
Mantenedores costumam responder em até 1 dia
-
community enhancement good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
Mantenedores costumam responder em até 1 dia