Reputation: 595
I am trying to create a jar file out of a directory Below is the structure of my files
test-dir - [Root folder]
src
QE (directory that i want to pack)
descriptor.xml
pom.xml
My pom file
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.test</groupId>
<artifactId>abc-test</artifactId>
<version>1.0.1</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptors>
<descriptor>descriptor.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>assemble</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
My descriptor.xml
<assembly>
<id>jar-assembly</id>
<formats>
<format>jar</format>
</formats>
<fileSets>
<fileSet>
<directory>QE</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
But when i run mvn package , i get the below error
[INFO] Reading assembly descriptor: descriptor.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.753 s
[INFO] Finished at: 2024-01-17T18:50:26-08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:3.3.0:single (assemble) on project abc-test: Error reading assemblies: Error locating assembly descriptor: descriptor.xml
[ERROR]
[ERROR] [1] [INFO] Searching for file location: E:\test-dir\descriptor.xml
[ERROR]
[ERROR] [2] [INFO] File: E:\test-dir\descriptor.xml does not exist.
[ERROR]
[ERROR] [3] [INFO] File: E:\test-dir\descriptor.xml does not exist.
[ERROR] -> [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]
Upvotes: 0
Views: 86
Reputation: 1
You need to specify your descriptor location as ${project.basedir}/descriptor.xml
since the file is available under root project directory test. By default, plugin execution happens in ${project.build.directory}
which is directory target.
Upvotes: 0