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

springboot2 sample not building with maven #336

Closed
thomashoef opened this issue Apr 20, 2020 · 13 comments
Closed

springboot2 sample not building with maven #336

thomashoef opened this issue Apr 20, 2020 · 13 comments
Assignees
Milestone

Comments

@thomashoef
Copy link

  • Implementations: Spring Boot

Scenario

I cloned the springboot2 petstore sample.

Expected behavior

sam build builds the project correclty.

Actual behavior

[INFO] Building zip: /private/var/folders/f1/7b0kkhxx3k169lx22ytcn5240000gn/T/tmpesmylcdf/target/serverless-springboot2-example-1.0-SNAPSHOT-lambda-package.zip
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ serverless-springboot2-example ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.781 s
[INFO] Finished at: 2020-04-20T21:08:06+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.5.2:install (default-install) on project serverless-springboot2-example: The packaging for this project did not assign a file to the build artifact -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Steps to reproduce

Clone the springboot2 petstore sample.
Run sam build (without having gradle installed / removing the gradle build file)

Full log output

see above.

@sapessi
Copy link
Collaborator

sapessi commented Apr 20, 2020

Thanks for the report. Looks like SAM is trying to run mvn install. These samples are not meant to be installed, simply packaged. If you run mvn clean package from the sample folder, does it succeed?

I'll reach out to the SAM team.

@thomashoef
Copy link
Author

thomashoef commented Apr 20, 2020 via email

sapessi added a commit that referenced this issue Apr 21, 2020
…SAM CLI's sam build command with maven (clean install) can work to address (#336)
@sapessi
Copy link
Collaborator

sapessi commented Apr 21, 2020

I've pushed a fix to the samples in the master branch that should make sam build work, and should therefore also fix #337.

@thomashoef
Copy link
Author

thomashoef commented Apr 21, 2020 via email

@thomashoef
Copy link
Author

thomashoef commented Apr 21, 2020 via email

@sapessi
Copy link
Collaborator

sapessi commented Apr 21, 2020

@thomashoef What are you trying to do? If you just want to unit test your application then you can replicate our tests without going through the CLI emulator

@ggokce
Copy link

ggokce commented Oct 26, 2020

Also the projects created using archetypes : com.amazonaws.serverless.archetypes and aws-serverless-springboot2-archetype do not work .

I got "classnotfoundexception on the StreamHandler. " The part we need to delete from pom is :


 <!-- don't build a jar, we'll use the classes dir -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <version>3.1.1</version>
                        <executions>
                            <execution>
                                <id>default-jar</id>
                                <phase>none</phase>
                            </execution>
                        </executions>
                    </plugin>

Best Regards.

@sapessi
Copy link
Collaborator

sapessi commented Oct 26, 2020

Thanks @ggokce I'll move your report to a new issue and track it as a bug. Do you want to open it or want me to do it (you won't get notifications if I do it)

@ggokce
Copy link

ggokce commented Oct 26, 2020 via email

@deki
Copy link
Collaborator

deki commented Jan 5, 2021

Just also hit this issue with 1.5.2 and added the following to fix it:

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-install-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>

@gavvvr
Copy link

gavvvr commented Feb 9, 2021

Currently you will face the same error ("The packaging for this project did not assign a file to the build artifact") if you use the latest aws-serverless-springboot2-archetype.

How to reproduce:

  • mvn archetype:generate -DgroupId=pingapp -DartifactId=ping-service -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=com.amazonaws.serverless.archetypes -DarchetypeArtifactId=aws-serverless-springboot2-archetype -DarchetypeVersion=1.5.2
  • remove build.gradle from generated project files
  • execute sam build

@deki deki self-assigned this Dec 30, 2021
@deki deki modified the milestones: Release 1.7, Release 1.6 Dec 30, 2021
@deki
Copy link
Collaborator

deki commented Dec 30, 2021

This should no longer happen with the latest archetype versions >=1.6. Please reopen if you still have problems.

@deki deki closed this as completed Dec 30, 2021
@deki deki reopened this Jan 6, 2022
@deki
Copy link
Collaborator

deki commented Jan 6, 2022

Just noticed that 253910f only fixed the pet-store samples and not the archetypes.

Will commit a different fix that covers both.

@deki deki modified the milestones: Release 1.6, Release 1.7 Jan 6, 2022
deki added a commit that referenced this issue Jan 6, 2022
…kaging for this project did not assign a file to the build artifact" message (#336)"

This reverts commit 253910f
@deki deki closed this as completed Jan 6, 2022
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

5 participants