Pom generating a jar with extra string at the end
Oxygen general issues.
-
- Posts: 18
- Joined: Tue Jul 12, 2022 10:17 pm
Pom generating a jar with extra string at the end
Hello and good day
My team and i are currently working on a project that generates a jar for one of our frameworks, but we are experiencing some issues.
The download site expects a jar with a certain name "porject.jar", however the build its generating a jar called 'project-plugin.jar', we have gone over the pom file and we have not been able to determine what could be changing the name, this is the content of our pom file:
The local build shows that the jar generated is indeed being created as "${project.artifactId}-${project.version}-plugin", but I haven't found a reason for this.
Is there something that I'm missing in the pom or could this be caused by another reason?
Thanks and Regards,
Frank
My team and i are currently working on a project that generates a jar for one of our frameworks, but we are experiencing some issues.
The download site expects a jar with a certain name "porject.jar", however the build its generating a jar called 'project-plugin.jar', we have gone over the pom file and we have not been able to determine what could be changing the name, this is the content of our pom file:
Code: Select all
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>"groupId"</groupId>
<artifactId>"ProjectName"</artifactId>
<version>1.0-SNAPSHOT</version>
<name>"ProjectName"</name>
<description>"ProjectName"</description>
<repositories>
<repository>
<id>public</id>
<name>oXygen public artifacts</name>
<url>https://www.oxygenxml.com/maven</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>RepoId</id>
<name>RepoName</name>
<url>RepoURL</url>
</repository>
</repositories>
<dependencies>
...
</dependencies>
<distributionManagement>
<repository>
<id>Repoid</id>
<name>RepoName</name>
<url>RepoURL
</url>
</repository>
<snapshotRepository>
<id>RepoId</id>
<name>RepoName</name>
<url>RepoUrl
</url>
</snapshotRepository>
</distributionManagement>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>dd-MM-yyyy HH:mm</maven.build.timestamp.format>
</properties>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifestEntries> <Build-Time>${maven.build.timestamp}</Build-Time></manifestEntries>
</archive>
<outputDirectory>${project.build.directory}/build</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
<configuration>
<archive>
<manifestEntries> <Build-Time>${maven.build.timestamp}</Build-Time></manifestEntries>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>libs/</classpathPrefix>
<mainClass>"MainClass".ContentManager</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef> <!--This is an intended extra jar we also need-->
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}</directory>
<includes>
<include>addon.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Is there something that I'm missing in the pom or could this be caused by another reason?
Thanks and Regards,
Frank
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Pom generating a jar with extra string at the end
Post by cristi_talau »
Hello,
The pom.xml file that you use is intended to generate an archive containing an Oxygen plugin.
By default, a Maven project generates a "JAR" file that contains the compiled Java classes from that project. However, an Oxygen plugin contains the JAR with compiled Java classes and some other configuration files. To differentiate between the two JAR files, the JAR file with archived classes is saved in "target/build" and the plugin is stored in "target" with the "-plugin" suffix.
The "-plugin" suffix is configured in the assembly.xml file in your project
Best,
Cristian
The pom.xml file that you use is intended to generate an archive containing an Oxygen plugin.
By default, a Maven project generates a "JAR" file that contains the compiled Java classes from that project. However, an Oxygen plugin contains the JAR with compiled Java classes and some other configuration files. To differentiate between the two JAR files, the JAR file with archived classes is saved in "target/build" and the plugin is stored in "target" with the "-plugin" suffix.
The "-plugin" suffix is configured in the assembly.xml file in your project
Best,
Cristian
-
- Posts: 18
- Joined: Tue Jul 12, 2022 10:17 pm
Re: Pom generating a jar with extra string at the end
Hello Cristian
Thank you for the quick response, we also looked into the assembly.xml however it seemed normal to us, its likely we missed something given the small size of the file itself, this is what we have:
I now know its because of the <id> tag, we did not realized that, thank you a lot.
Is there a way to make the id be blank as to not add any other strings?
Thanks and Regards,
Frank
Thank you for the quick response, we also looked into the assembly.xml however it seemed normal to us, its likely we missed something given the small size of the file itself, this is what we have:
Code: Select all
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>plugin</id>
<formats>
<format>jar</format>
</formats>
<fileSets>
<fileSet>
<directory>target/lib</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>
<files>
<file>
<source>target/build/${project.build.finalName}.jar</source>
<outputDirectory>/lib</outputDirectory>
</file>
<!--This is an attempt at generating a jar without the '-plugin' in the target directory -->
<file>
<source>target/build/${project.build.finalName}.jar</source>
<outputDirectory>${basedir}/target/</outputDirectory>
</file>
<file>
<source>plugin.xml</source>
<outputDirectory>/</outputDirectory>
<filtered>true</filtered>
</file>
</files>
</assembly>
Is there a way to make the id be blank as to not add any other strings?
Thanks and Regards,
Frank
Last edited by FrankDLT on Wed Nov 23, 2022 8:58 pm, edited 1 time in total.
-
- Posts: 18
- Joined: Tue Jul 12, 2022 10:17 pm
Re: Pom generating a jar with extra string at the end
Just as an additional note, I tried using the tag AppendAssemblyId false to try and avoid the issue, but the jar that is generated this way doesn't contain the data that I need, even if this is the only change made to the configuration.
-
- Posts: 81
- Joined: Wed Jul 20, 2016 8:22 am
Re: Pom generating a jar with extra string at the end
Post by mihai_coanda »
Hello,
After digging around the maven-assembly-plugin documentation it seems that the "-plugin" suffix comes from the assembly-plugin's default configuration to append the assembly-id to the produced jar name.
To disable this functionality you will have to disable this behavior by passing the appendAssemblyId [1] configuration parameter to the assembly-plugin in pom.xml.
Best Regards,
Michael
1. https://maven.apache.org/plugins/maven- ... assemblyid
After digging around the maven-assembly-plugin documentation it seems that the "-plugin" suffix comes from the assembly-plugin's default configuration to append the assembly-id to the produced jar name.
To disable this functionality you will have to disable this behavior by passing the appendAssemblyId [1] configuration parameter to the assembly-plugin in pom.xml.
Best Regards,
Michael
1. https://maven.apache.org/plugins/maven- ... assemblyid
Michael
https://www.oxygenxml.com
https://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service