I am forced by Maven to specify a url under tag insde POM.xml file
<distributionManagement>
<repository>
<id>nexus</id>
<name>Nexus Staging Repo</name>
<url>scp://home/maven2/html</url>
</repository>
</distributionManagement>
I am running mvn deploy to deploy the war file under Tomcat Web-apps
I don't have any domain , what should be the default to be provided here , and the username and the password inside , so that maven deploys my war into Tomcat .
The deploy phase in the maven lifecycle refers to deploying artifacts to a maven repository, not deploying artifacts to an application server. If you want to deploy your webapp I suggest you have a look at the maven cargo plugin.
Edit: Just to be extra clear: Deploying webapps to tomcat is not what "mvn deploy" is supposed to do.
Related
I have a project where I am packaging a WAR using simple maven-war-plugin. Along with all other dependencies one of the dependency say 'abc.jar' which is getting packaged in war contains a default spring configurations which I would like to update with the custom one before packaging. I have maven profile configured to be activated if following build command applied;
mvn clean install -DframeworkPacakging=XYZ
I am trying to use 'truezip-maven-plugin' to overwrite my custom spring configurations inside in 'abc.jar' present in 'target/aretfacts-id/WEB-INF/lib' but when maven-war-plugin finishes I loose my changes because war plugin takes the file from dependency definition. How can I solve this issue and what are my options?
P.S. Distributing configuration is not desirable as this setup would be used for Embedded Jetty Server running within Eclipse
to prevent inclusion of the original jar file, I would use go for approach suggested on: https://www.mail-archive.com/users#maven.apache.org/msg38537.html
Use <scope>provided</scope> for this dependency to keep it out of the
lib directory.
to include the repackaged one, I'd follow suggestion from: How to make Maven copy resource file into WEB-INF/lib directory?
Try changing the configuration of the maven war plugin to include a webResource:
<configuration>
<webResources>
<resource>
<directory>pathtorepackagedjar</directory>
<includes>
<include>**/abc.jar</include>
<includes>
<targetPath>WEB-INF/lib</targetPath>
</resource>
</webResources>
</configuration>
I want to separate the deployment portion and the compilation portion of a mule application. Does anyone know how to do this? To be specific, if I want a script that can compile my mule application, what do I need to do? What are the libraries that will be required for this?
You need to use the maven-mule-plugin to have Maven build an application archive.
Here is a sample configuration:
<plugin>
<groupId>org.mule.tools</groupId>
<artifactId>maven-mule-plugin</artifactId>
<version>1.9</version>
<extensions>true</extensions>
<configuration>
<copyToAppsDirectory>true</copyToAppsDirectory>
<excludeMuleDependencies>true</excludeMuleDependencies>
<inclusions>
<inclusion>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-cache</artifactId>
</inclusion>
</inclusions>
</configuration>
</plugin>
Be sure to have this repository active at build time:
<repository>
<id>mulesoft-releases</id>
<name>MuleSoft Repository</name>
<url>https://repository.mulesoft.org/releases/</url>
<layout>default</layout>
</repository>
Also be sure to have:
<pluginGroup>org.mule.tools</pluginGroup>
in your <pluginGroups> (typically in ~/.m2/settings.xml).
Building mule applications from command line is pretty straight forward.
As OOTB solutions MuleSoft provides support both for Maven and Ant
See... You don't need to get Mule installed.... Only you need to get Maven installed.....
After creating an application in your Mule ..... Add the above Plugin in the pom.xml file and it use the command mvn clean install in your command prompt ...... it will automatically build the application and deploy it to Mule standalone
It seems to me the question posted also asking for the command to acutally compile and create the deployment via the command line. As long as the pom is setup correctly just type the following (as long as maven is installed)
mvn clean package
The archived package ready for deployment will be in the target directory.
I am trying to download a jar for an internal repo with I have under tomcat and then install it to my local maven repo.
The jar file can be found under the path:http://10.11.250.14/strepo/ext/JSErrorCollector-0.2.jar.
I edit my pom.xml providing the link of the internal repo and also add a dependency in the pom.xml but the maven cannot download the jar.
<repositories>
<repository>
<id>internal.repo</id>
<url>http://10.11.250.14/strepo/ext/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.JS</groupId>
<artifactId>JSErrorCollector</artifactId>
<version>0.2</version>
</dependency>
Could you please anyone help me?
It's not just the jar only to make a Maven repository, there are a bunch of other stuffs required to be regarded as Maven repository. From the URL I think it is not a standard Maven repository layout.
So you have at least 2 options:
Setup your own local network Maven repository, either using Artifactory, Nexus or other similar software systems.
Download the file and add it to your local machine repository.
For option 2, just download the file, and then run the Maven mvn command as follow (assuming the file is at your current directory):
mvn install:install-file -Dfile=JSErrorCollector-0.2.jar -DgroupId=strepo.ext -DartifactId=JSErrorCollector -Dversion=0.2 -Dpackaging=jar
After that you can refer to that using:
<dependency>
<groupId>strepo.ext</groupId>
<artifactId>JSErrorCollector</artifactId>
<version>0.2</version>
</dependency>
I have a project where I need the JNLP API. I did not find an artifact for that on Maven Central, so I added an external Repository which offers that to my pom. That repository went offline this weekend. This is the second time something like this happened to me.
I know this is pretty much what Maven is not about, but really I just want that tiny jnlp-api-1.5.0.jar file to be
In my SCM (I don't want to roll my own Maven repository for just one dependency).
In the compile scope when the project builds.
Which knobs do I have to turn to accomplish this?
As of JDK 7.0, the JNLP API is being provided by the javaws.jar file in your JRE's lib directory, i.e., ${java.home}/lib/javaws.jar. It is possible to use the maven dependency scope system.
<project>
...
<dependencies>
<dependency>
<groupId>javax.jnlp</groupId>
<artifactId>jnlp-api</artifactId>
<version>7.0</version>
<scope>system</scope>
<systemPath>${java.home}/lib/javaws.jar</systemPath>
</dependency>
</dependencies>
...
</project>
You can put the JAR in your local repository using the install-file goal of the maven-install-plugin and reference it as you normally would in your POM. The command would be:
mvn install:install-file -Dfile=/path/to/jnlp-api-1.5.0.jar -DgroupId=<group-id> -DartifactId=<artifact-id> -Dversion=1.5.0 -Dpackaging=<packaging>
Place this command in a script and check it into your SCM. That way, you (and anyone else working on this project) can install it easily to the local repo.
I was wondering what would be the best practice to deploy a maven packaged WAR file to tomcat.
Using maven release plugin I get a versioned war file for my project
eg: myservice-1.0.0.war
I would like to deploy it to tomcat so that I can access it as follows
eg: http://localhost:8080/myservice
By default tomcat explodes the war file as a directory with a name myservice-1.0.0 under CATALINA_HOME/webapps. But I want to to explode the war as a directory with a name myservice for the reasons mentioned above.
I know I can simply rename myservice-1.0.0.war >> myservice.war and then deploy it in Tomcat.
I wanted to find out what others do?
I would do it by mentioning myservice as artifactId and final name and using maven cargo plugin to deploy to tomcat.
http://cargo.codehaus.org/Maven2+Plugin+Tips
You can package file /META-INF/context.xml with content like this:
<?xml version="1.0"?>
<!DOCTYPE Context>
<Context path="myapp">
</Context>
See documentation at http://tomcat.apache.org/tomcat-5.5-doc/config/context.html
I ran into the same problem. What worked for me was inserting this properties element into the cargo deployable configuration:
<deployable>
<groupId>org.something</groupId>
<artifactId>something-idm-esb</artifactId>
<properties>
<context>something-idm-esb</context>
</properties>
<type>war</type>
</deployable>
Without this properties element, the app would be deployed to localhost:8080/something-idm-esb-0.9.14.2 which is not what the app needs at runtime. With the properties section, the app is deployed to localhost:8080/something-idm-esb/
Instead of renaming the war file you could do this:
Just add following in your tomcat-dir/conf/server.xml in between <Host>..<\Host> tags.
for : myservice-1.0.0.war file
<Context path="/myservice" docBase="/myservice-1.0.0" debug="0" reloadable="true"></Context>
Reference