I'm trying to create a Java Spring online app using AWS CodeStar. I created a new CodeStar project and the default code was building, deploying and working fine.
I copied my project into the CodeStar project folder and pushed the code. The pipeline picked up the code and properly built it, but the last step of the Deploy part failed.
When I looked at the details, I found out at the EC2 instance events that the failure was during the installation step.
The error message says:
No such file or directory - /opt/codedeploy-agent/deployment-root/dcda2f79-ce8e-40cc-80ee-f5d6478b7cd1/d-I4JUDJUB6/deployment-archive/target/ROOT.war
I connected to the EC2 instance and look at the specified path and indeed, in the folder "deployment-archive" there is no "target" folder. So we know where the problem is.
BUT - since the pipeline picks the code itself immediately after I push it, it should take care of this itself. So I don't really know what they want from me.
Does anybody know how to solve this issue?
I found out that the problem is in the build settings of the pom.xml. In the end I simply copied the build settings of the original CodeStar default project. In my case it is:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>ROOT</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<finalName>ROOT</finalName>
</build>
For your case it might look differently. But this worked for me.