Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

JavaMavenWorkflow sam build fails with `[Errno 20] Not a directory`

Aperta
#113 8 commenti 5 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
java, python
Ambito
build-system, cli

Direzione di ricerca

Inizia con JavaMavenWorkflow e il suo passaggio CopySource, quindi esamina la chiamata a copytree mostrata nel traceback. Riproduci sam build --debug con CodeUri che punta a lambdas/mainlambda/target/lambda.jar e confrontalo con il comando previsto del reactor Maven. Il lavoro è completato quando il progetto esistente crea il JAR senza il NotADirectoryError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area/workflow/java_maven maintainer/need-response

Getting an error when running sam build in an existing project of mine,
where the sam template has a CodeUri that points to a JAR file in a reactor build submodule.

Steps to reproduce the issue:

  1. existing java maven project using reactor builds with
    1.1 a shaded jar generated in a maven submodule's target directory
    (<project-top-level>/lambdas/mainlambda/target/lambda.jar in my case)
    1.2 a template.yaml in the <project-top-level> directory using
    CodeUri: lambdas/mainlambda/target/lambda.jar
  2. cd <project-top-level>
  3. sam build --debug

Observed result:

2019-04-28 19:31:55 Collected default values for parameters: {}
2019-04-28 19:31:55 12 resources found in the template
2019-04-28 19:31:55 Found Serverless function with name='LatestFunction' and CodeUri='lambdas/mainlambda/target/lambda.jar'
2019-04-28 19:31:55 Found Serverless function with name='LiveFunction' and CodeUri='lambdas/mainlambda/target/lambda.jar'
2019-04-28 19:31:55 Found Serverless function with name='TestRunnerFunction' and CodeUri='lambdas/testlambda/target/lambda.jar'
2019-04-28 19:31:55 Building resource 'LatestFunction'
2019-04-28 19:31:55 Looking for a supported build workflow in following directories: ['<scrubbed>/GitRepos/someproject/lambdas/mainlambda/target/lambda.jar', '<scrubbed>/GitRepos/someproject']
2019-04-28 19:31:55 Loading workflow module 'aws_lambda_builders.workflows'
2019-04-28 19:31:55 Registering workflow 'PythonPipBuilder' with capability 'Capability(language='python', dependency_manager='pip', application_framework=None)'
2019-04-28 19:31:55 Registering workflow 'NodejsNpmBuilder' with capability 'Capability(language='nodejs', dependency_manager='npm', application_framework=None)'
2019-04-28 19:31:55 Registering workflow 'RubyBundlerBuilder' with capability 'Capability(language='ruby', dependency_manager='bundler', application_framework=None)'
2019-04-28 19:31:55 Registering workflow 'GoDepBuilder' with capability 'Capability(language='go', dependency_manager='dep', application_framework=None)'
2019-04-28 19:31:55 Registering workflow 'GoModulesBuilder' with capability 'Capability(language='go', dependency_manager='modules', application_framework=None)'
2019-04-28 19:31:55 Registering workflow 'JavaGradleWorkflow' with capability 'Capability(language='java', dependency_manager='gradle', application_framework=None)'
2019-04-28 19:31:55 Registering workflow 'JavaMavenWorkflow' with capability 'Capability(language='java', dependency_manager='maven', application_framework=None)'
2019-04-28 19:31:55 Registering workflow 'DotnetCliPackageBuilder' with capability 'Capability(language='dotnet', dependency_manager='cli-package', application_framework=None)'
2019-04-28 19:31:55 Found workflow 'JavaMavenWorkflow' to support capabilities 'Capability(language='java', dependency_manager='maven', application_framework=None)'
2019-04-28 19:31:55 Running workflow 'JavaMavenWorkflow'
2019-04-28 19:31:55 Running JavaMavenWorkflow:CopySource
2019-04-28 19:31:55 JavaMavenWorkflow:CopySource raised unhandled exception
Traceback (most recent call last):
  File "<scrubbed>/.virtualenvs/aws/lib/python3.6/site-packages/aws_lambda_builders/workflow.py", line 248, in run
    action.execute()
  File "<scrubbed>/.virtualenvs/aws/lib/python3.6/site-packages/aws_lambda_builders/actions.py", line 101, in execute
    copytree(self.source_dir, self.dest_dir, ignore=shutil.ignore_patterns(*self.excludes))
  File "<scrubbed>/.virtualenvs/aws/lib/python3.6/site-packages/aws_lambda_builders/utils.py", line 43, in copytree
    names = os.listdir(source)
NotADirectoryError: [Errno 20] Not a directory: '<scrubbed>/GitRepos/someproject/lambdas/mainlambda/target/lambda.jar'

Expected result:

I would expect it to run the equivalent of

(in <project-top-level> folder)
mvn package -Dmaven.test.skip=true -pl lambdas/mainlambda -am

Which is what i run when I want to just build lambda.jar

  • -pl lambdas/mainlambda because that is the module folder of the target folder where lambda.jar is located.
  • -am because otherwise reactor builds will fail
  • -Dmaven.test.skip=true because when run from the aws-toolkit, you don't want to rerun the whole test suite (?)

This sam build failure is preventing me from creating launch configurations using aws-toolkit for Intellij.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

I don't believe my environment makes any difference in this issue, but I'll answer any request for more information if that is deemed necessary

Lingua principale
Python
Stelle
381
Fork
162
Merge medio
1g 1h
PR unite (30g)
2

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws/aws-lambda-builders

Tutte le issue di aws/aws-lambda-builders

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.