maven-plugin

How to put maven project version in war file manifest?

蹲街弑〆低调 提交于 2019-12-02 20:25:11
I need to have Maven insert the version number from the POM file into the manifest located in the WAR file under /WEB-INF/manifest.mf. How do I do this? I was able to easily file documentation for doing this in a JAR file using the maven-jar-plugin, but that does not work on a WAR file. Thanks for the help! Figured it out using the maven-war-plugin. See the configuration below: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <archive> <manifestEntries> <version>${project.version}</version> </manifestEntries

Programmatically resolving Maven dependencies outside of a plugin - get RepositorySystemSession and RepositorySystem

与世无争的帅哥 提交于 2019-12-02 19:32:19
Maybe this is going to be a larger task than I had originally thought, but regardless, I'm trying to load a MavenProject from a file and then resolve its dependencies. I've got the code for both bits but I'm missing some object references that I need; specifically I need to get instances of RepositorySystemSession and RepositorySystem . Any tips? Note: I have tagged this question with maven-plugin , but this is not a Maven plugin. I am happy to mandate Maven 3 (think I already have anyway..) Here's the code I have so far: Constructing the MavenProject : public static MavenProject loadProject

Maven build number plugin, how to save the build number in a file?

夙愿已清 提交于 2019-12-02 18:14:35
I've a Java project using Spring Framework and Git and I wanted to display a build number. I found the Build Number Maven plugin . With Git the build number is a Git hash. I dislike that and I thought a date was much more expressive. I found this excellent blog article explaining how to use build number plugin with a different profile for SVN and Git. Since I just use Git, instead of creating a new profile, I just copied the plugin part in my build tag. When I run "mvn package" it tells me: [INFO] --- buildnumber-maven-plugin:1.0:create (default) @ sherd --- [INFO] Storing buildNumber: 2011-08

Maven Cobertura plugin not generating coverage.xml

▼魔方 西西 提交于 2019-12-02 17:26:40
I am trying to generate a coverage.xml so that I can reference it in Cobertura plugin of Hudson, but the file is not being created. I've added the following to my POM <reporting> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>2.5.1</version> <configuration> <formats> <format>html</format> <format>xml</format> </formats> </configuration> </plugin> </plugins> </reporting> After running mvn cobertura:cobertura, the HTML site is generated as expected at **\target\site\cobertura, but coverage.xml is nowhere to be found. What am I

tomcat7-maven-plugin tomcatManager status code:403, ReasonPhrase:Forbbiden

坚强是说给别人听的谎言 提交于 2019-12-02 16:56:44
I am trying to do mvn clean package tomcat7:deploy but always I get this error: tomcatManager status code:403, ReasonPhrase:Forbbiden My configurations are the next: ~/.m2/settings.xml <servers> <server> <id>localhost</id> <username>tomcat</username> <password>s3cret</password> </server> </servers> pom.xml <profiles> <profile> <id>tomcat-localhost</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <tomcat-server>localhost</tomcat-server> <tomcat-url>http://localhost:8080/manager/html</tomcat-url> </properties> </profile> </profiles> <build> <plugin> <groupId

Plugins in Maven and POM.xml

随声附和 提交于 2019-12-02 16:31:43
I just started using Maven and I read that plugins are additional components that can be used. A typical structure of pom.xml file is <project> <groupId>org.koshik.javabrains</groupId> <artifactId>JarName</artifactId> (A fldernamed JarName was created) <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>JarName</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> <

How to support multiple Scala versions in a library

倾然丶 夕夏残阳落幕 提交于 2019-12-02 16:12:39
I have a fairly normal Scala project currently being built using Maven. I would like to support both Scala 2.9.x and the forthcoming 2.10, which is not binary or source compatible. I am willing to entertain converting to SBT if necessary, but I have run into some challenges. My requirements for this project are: Single source tree (no branching). I believe that trying to support multiple concurrent "master" branches for each Scala version will be the quickest way to miss bugfixes between the branches. Version specific source directories. Since the Scala versions are not source compatibile, I

How to ignore maven profiles in child module?

允我心安 提交于 2019-12-02 11:51:16
I want to run the simple flow, I have 6 profiles: generate-schema,unpack-war,run-jetty,test,stop-jetty,start-stop-app the test profile will run on a different child module when I declare it in the mvn goals/properties: * clean --activate-profiles generate-schema,unpack-war,start-stop-app,test --projects apm-tests,apm-tests\apm-adapter-tests verify.* How can I make the child module run only the tests and skip the rest of the profiles (generate-schema and etc.) ? Parent pom sample: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3

Templating a Maven Archetype

依然范特西╮ 提交于 2019-12-02 08:12:34
问题 I am creating my own maven archetype, which is a common template for projects that i use. In that template i have a number of "exec-maven-plugin" blocks, which actually varies for each project, meaning that in a project i might have 2 "exec-maven-plugin" blocks and in another one i might have 3 or more. I would like that to be driver by the user, at the time he creates a project using the archetype i have created. For example the user will be asked for a number of main classes and according

Activation in my maven profile is ignored (profile always executed) using file exist

我的梦境 提交于 2019-12-02 07:51:10
问题 I am using activation based on file exists in my pom.xml. However, my profile is ALWAYS executed, no matter what. Here is the profile description: <profile> <id>copy</id> <activation> <file> <exists>file.xml</exists> </file> </activation> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.7</version> <executions> <execution> <id>copy-resources</id> <phase>validate</phase> <configuration> <target name="copy and rename