maven-2

How to write a Maven build script to execute Java

混江龙づ霸主 提交于 2019-12-04 10:47:01
How can I execute a Java program during the build, or after the build has just finished? Is it possible to do this directly from pom? mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main EDIT Let's say I want to execute org.eclipse.content.MyClass . How would I needed to write the code? This builds the project but it doesn't execute my class: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.1</version> <executions> <execution> <phase>deploy</phase> <goals> <goal>java</goal> </goals> </execution> </executions> <configuration>

JSP hot-swap in Maven glassfish embedded plugin

纵然是瞬间 提交于 2019-12-04 10:46:41
I am trying to setup embedded glassfish maven plugin and I succeeded, but I can't make jsp files to be hot-swapped. Here is my config: <plugin> <groupId>org.glassfish</groupId> <artifactId>maven-embedded-glassfish-plugin</artifactId> <version>3.0.1</version> <configuration> <instanceRoot>${project.build.directory}</instanceRoot> <goalPrefix>embedded-glassfish</goalPrefix> <app>target/myapp.war</app> <port>8080</port> <contextRoot>myapp</contextRoot> <autoDelete>true</autoDelete> </configuration> </plugin> Any clues? Resurrection for further reference. I managed to do that by deploying an

How to convert file separator in maven

[亡魂溺海] 提交于 2019-12-04 10:45:36
问题 I have a property defined like this: <properties> <main.basedir>${project.parent.basedir}</main.basedir> </properties> Since I use Windows as OS, it contains backslashes. I want to add this path to a glassfish domain as JVM option (using glassfish maven plugin). The problem is, that asadmin can consume only slash as separator, and all my backslashes keep on disappearing. How can I define a property with exactly the same content with slashes? 回答1: I don't think there is a non-programmatical

Eliminate Maven POM redundancy

╄→尐↘猪︶ㄣ 提交于 2019-12-04 10:41:42
I have a parent POM with the following config <groupId>com.example</groupId> <artifactId>parent</artifactId> <version>1.2-SNAPSHOT</version> Each child project which inherits from this parent POM, has a config such as the following: <parent> <groupId>com.amadeus.jcp.ui.skinning.skinning-system</groupId> <artifactId>parent</artifactId> <version>1.2-SNAPSHOT</version> </parent> I want all these project version numbers to stay in synch. At the moment, if I change the parent version to 1.3, I then have to go change all the child project versions to 1.3. Is there any way I can avoid duplicating the

Class file from a external jar not found during maven build? [duplicate]

僤鯓⒐⒋嵵緔 提交于 2019-12-04 10:36:57
This question already has answers here : Can I add jars to maven 2 build classpath without installing them? (23 answers) Closed 3 years ago . I have created a runnable jar which i included in my project(Maven Project). But when i tried doing mvn clean package. My build gets failed It gives me an error in one of my class imports stating that the package does not exist(which is present in jar). What i tried: Tried adding the jat in Web App Libraries. Adding the jar as external jar. Adding it in lib folder. Error Message: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1

Strategies for java webapp configuration

蹲街弑〆低调 提交于 2019-12-04 10:22:06
Part of my webapp involves uploading image files. On the production server, the files will need to be written to /somepath_on_production_server/images. For local development, I want to write the files to /some_different_path/images. What's the best way to handle these configuration differences? One important requirement is this: I don't want to have to mess with the production server at all, I just want to be able to deploy a war file and have it work. So I don't want to use any technique which will require me to mess with the environment variables/classpath/etc. on the production machine. I'm

Maven Proxy settings.xml ignored

我是研究僧i 提交于 2019-12-04 10:11:47
问题 Maybe someone can help me with the following Problem: I have declared a proxy in M as described at maven - Configuring a proxy. For some reason the proxy is ignored, although the proxy itself works correctly with maven when setting the proxy via command line. When calling the maven goal like this, it works: mvn -DproxySet=true -DproxyHost=myproxy.com -DproxyPort=3128 eclipse:eclipse Any suggestions for this problem? 回答1: When settings.xml is ignored, I tend to check first if the environment

set java system property during maven 2 compile?

烈酒焚心 提交于 2019-12-04 10:11:22
I have a maven profile and want to set a property which is later on available per System.getProperty(..) in java: <profile> <id>local-dev</id> <properties> <my.comp.my.prop>myValue</my.comp.my.prop> </properties> </profile> I want System.getProperty("my.comp.my.prop") to be "myValue" but it's null .. How do I set it correctly? :) Thansk! maven cannot set a property which can be accessed by your application from the environment at runtime. Instead, you can use maven to update a property file in your codebase during build time, which can then be read by your application at runtime. Different

Reading a file from a jar, or anywhere on the classpath?

房东的猫 提交于 2019-12-04 09:43:32
问题 I'm trying to build an application that builds a resource file into a jar, but I'd like to have the project runnable within eclipse. I have a basic maven 2 structure for my project, and I'm unsure how to read in the file such that it's found and used when run from the JAR or from within eclipse. Thought? Structure: src/main/java src/main/resources/file.txt Current reading method: getClass().getResourceAsStream("/file.txt") Is there reading method that will pick up src/main/resources/*, as

Starting apache server before integration testing not working

我们两清 提交于 2019-12-04 09:33:33
I have a web application named as GroupWebApplication. Using pom.xml file I'm just creating the war of my application and deploying to tomcat server. This is basically a maven project. I have added plugins for tomcat7 apache server. Now what I want that I want to start the tomcat server then run the integration tests and after the completion of the integration tests I want to stop the server. Basically I'm using the testng.xml file of TestNg framework.testng.xml files contains all the classes for integration tests. Manually it's working fine, i.e. starting the server manually and running the