Maven Install adds version id in final name of the war file - maven

I am beginner with maven.
I have a pom file something like this
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>group</groupId>
<artifactId>artID</artifactId>
<version>${FILE_VERSION}</version>
...
When the install command is run, I get example_dir/1.0.1/application-1.0.1.war
I want to retain version in directory structure but I want to remove the version from war file name.
Is it possible?

The structure in the local repository (usually .m2/repository) is fixed and cannot be changed.
If you need a different name, you need to rename the file after downloading it from the local repository.

Related

maven read pom.xml containing multiple modules and write file

We have "master" pom.xml file and has multiple modules, using maven-antrun-plugin or other plugin, how do we be able to achieve by means of writing a file to all module folders in this master pom.xml? Want to store a file containing "${project.version}". For instance, we run mvn clean verify, we want to retrieve the version from this master pom.xml and store as file to all multiple modules.
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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mp</groupId>
<artifactId>parentApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parentApp</name>
<description>This is just to test pom inheritance</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<modules>
<module>../example1</module>
<module>../example2</module>
<module>../example3</module>
<module>../example4</module>
<module>../example5</module>
..
..
Never mind - we can add exec-maven-plugin to run the bash script to list all multiple modules, for loop - copy the folder to all modules.

How to use smartics-jboss-modules maven plugin in maven project

We can create module.xml manually and keep it in modules folder of Jboss. But to autogenerate it, there is a plugin called smartics-jboss-modules-maven-plugin. Has anyone implemented it in maven project. My requirement is to generate module.xml and module from maven project and automatically add it to jboss modules folder. I need to know the exact steps to implement it in my project.
and inside that particular folder make sure you create a file that complies with the following model
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
</project>
As documented in here:
https://www.smartics.eu/confluence/display/SJBMMP/The+smartics+JBoss+Modules+XSD

Can't figure out a global setting for pom.xml

I'm trying to compile an open source project on Github that has no build instructions. I know it's built with Maven, but there are some variables that need to be set in settings.xml and I cannot find in the Maven documentation anything about the custom variables (outside of "servers", "proxies", etc). I found this answer that helps a bit, but I still cannot figure it out.
For example, Where do I set the value ${global.awe.version} used in the top level pom.xml file, where it seems to be defined 2 lines later:
<global.awe.version>3.6.0-rc-05</global.awe.version>?
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
...
<version>${global.awe.version}</version>
<properties>
<global.awe.version>3.6.0-rc-05</global.awe.version>
<global.awe-api.version>2.2.0-rc-05</global.awe-api.version>
</properties>
...

OpenDolphin Maven on Netbeans basic config

I'm trying to get started with JavaFX / OpenDolphin and have downloaded the jumpstart zip. When I import the Maven zip into Netbeans, I get the expected project tree. Then I try to run jumpstart_0 and get the following error:
Could not find artifact MyFirstDolphin:server:jar:1.0-SNAPSHOT
As Maven is also new to me, I am puzzled as to where to begin solving this problem.
Two suggestions by HelpWiki are:
The POM misses the declaration of the repository which hosts the artifact.
The repository you have configured requires authentication and Maven failed to provide the correct credentials to the server. In this case, make sure your ${user.home}/.m2/settings.xml contains a declaration whose matches the of the remote repository to use.
Here is the current pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>MyFirstDolphin</artifactId>
<groupId>MyFirstDolphin</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>shared</artifactId>
</project>
There is obviously some basic knowledge I'm lacking and it would be great if someone could shed some light on this. DolphinJumpStart doesn't work 'out of the box' in Netbeans 8 on Windows 7, so there must be others with the same problem?

Automate creation of pom file dependencies based on the jar file

I have hundreds of jar files scattered across different projects that I need to create pom file dependencies files for. I'd really like to avoid manually searching for every jar file and adding the dependency manually. Is there an API I can use to accomplish this task or some other way ?
Ive tried using a generic pom as described : http://maven.apache.org/plugins/maven-install-plugin/examples/generic-pom-generation.html
Using this command - mvn install:install-file -Dfile=spring-webmvc-portlet-3.0.6.RELEASE -DgroupId=test -DartifactId=test -Dversion=version -Dpackaging=jar-DgeneratePom=true
But should the generated pom not match the jar file ? Or do I need to add this myself
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>version</version>
<packaging>jar-DgeneratePom=true</packaging>
<description>POM was created from install:install-file</description>
</project>
I wrote a script that generates an ivy file. It uses the jar checksums to identify the matching modules in Maven central.
https://github.com/myspotontheweb/ant2ivy
This solution could be adapted to generate a Maven POM.
You may create a bash script which uses the Maven Install plugin to produce a generic POM.
See http://maven.apache.org/plugins/maven-install-plugin/examples/generic-pom-generation.html

Resources