maven-2

maven webapp to place jsps in /WEB-INF/jsp

流过昼夜 提交于 2019-12-03 14:08:53
问题 I have inherited a webapp built using NetBean's internal ant. All jsps reside in: WEB-INF/jsp And the web.xml has hardcoded links to /WEB-INF/jsp/somefile.jsp How can I use the maven war plugin to place the JSP there, maintaining consistency with the current structure ? My pom currently reads: <warSourceDirectory>${basedir}/web/WEB-INF</warSourceDirectory> 回答1: What the problem? Let's look at a standard war project structure: $ mvn archetype:create -DgroupId=com.mycompany.app \ > -DartifactId

Divide Spring configuration across multiple projects

做~自己de王妃 提交于 2019-12-03 14:00:47
问题 we have quite a few projects that use the same codebase (backend code). Just the frontend tends to be different. We decided that the best approach would be to seperate backend and frontend into different projects: Engine and Project_name Now these are Spring-projects. So it would only seem logical if we divide the Spring configurations aswell: Database.xml , Services.xml would belong to the project Engine . And a specific Frontend.xml would belong to Project_Name . To link these up, I would

How to deliver properties files in addition to artifacts?

折月煮酒 提交于 2019-12-03 13:45:44
I am using Maven2 to build a WAR project. Some properties files are dependent on the environment targeted for a release. I want to deliver, in addition of the WAR, a file called datasource.xml . This file already exists in my project directory, but contains properties that will be filtered during the build (i.e. some ${foo.bar} ). In others words, after running the command mvn clean install , I want to see in my target/ directory two files, my-webapp.war and datasource.xml . Note that datasource.xml must not be included in the my-webapp.war artifact! How can I do this? You can attach

Maven 2: How to package current project version in a WAR file?

南笙酒味 提交于 2019-12-03 13:25:35
问题 I am using Maven 2 to build my Java project and I am looking for a way to present the current version number of the pom.xml to the user (using a Servlet or JSP for example). As far as I can see, the best way would be that Maven packages the version number as a text file into the WAR. This allows me to read the version from that file and present it the way I want. Does anyone know of a plugin that can do something like that for me? Maybe the WAR plugin can be configured to do so? Or maybe

double unit test reporting with hudson and maven

时光总嘲笑我的痴心妄想 提交于 2019-12-03 13:11:58
I have a maven2 project in hudson and when the cobertura reporting plugin runs, it causes the unit tests to show that they have run twice. I don't mind them running multiple times, but the trend graph shows twice as many tests as we actually are running. Is there a way to make sure the graph only shows them once? thanks, Jeff This is a known bug. Just wait for it to be fixed. The workaround I use (works in Hudson 1.391) is to configure cobertura in separate Maven profile and run it in a Hudson job as a post-build step. Mode detailed instructions: Add cobertura to your project pom in a special

Resolving a Maven dependency differently if the JVM in use is x86 or x64?

老子叫甜甜 提交于 2019-12-03 13:05:41
I have a Maven repository set up to host some dlls, but I need my Maven projects to download different dlls depending on whether the JVM in use is x86 or x64. So for example, on a computer running an x86 version of the JVM I need ABC.dll to be downloaded from the repository as a dependency, but on another computer running an x64 version of the JVM, I need it download XYZ.dll instead. How would I go about doing this? An example pom.xml file would be nice. This will work on any VM. You can use profiles to have alternate configurations according to the environment. A profile contains an

Is the maven-native-plugin widely used to build C++ projects using maven?

荒凉一梦 提交于 2019-12-03 13:04:15
It's been a little while since I did C++ development professionally and I'd like to get caught up on what the current state of C++ development is in a number of areas. Most of my recent work has been Java, making heavy use of Maven. When I last did C++ development for work, some variant of make was widely accepted as the way to go for building C++ projects (we were also using make to do builds the Java code in our mixed Java and C++ projects, although I believe ant was starting to become mainstream). I like using Maven for builds. My question is not to debate the relative merits of using Maven

How do you force a maven MOJO to be executed only once at the end of a build?

一笑奈何 提交于 2019-12-03 12:59:54
I have a MOJO I would like executed once, and once only after the test phase of the last project in the reactor to run. Using: if (!getProject().isExecutionRoot()) { return ; } at the start of the execute() method means my mojo gets executed once, however at the very beginning of the build - before all other child modules. The best solution I have found for this is: /** * The projects in the reactor. * * @parameter expression="${reactorProjects}" * @readonly */ private List reactorProjects; public void execute() throws MojoExecutionException { // only execute this mojo once, on the very last

Running single test class or group with Surefire and TestNG

邮差的信 提交于 2019-12-03 12:52:58
I want to run single test class from command line using Maven and TestNG Things that doesn't work: mvn -Dtest=ClassName test I have defined groups in pom.xml, and this class isn't in one of those groups. So it got excluded on those grounds. mvn -Dgroups=skipped-group test mvn -Dsurefire.groups=skipped-group test when config is <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.7.1</version> <configuration> <groups>functest</groups> </configuration> </plugin> Parameters work fine in there are no groups defined in pom.xml. Similarly,

Change maven dependency for artifact using classifier

岁酱吖の 提交于 2019-12-03 12:48:36
With the maven jar plugin I build two jar: bar-1.0.0.jar and bar-1.0.0-client.jar. Actually in my POM I have the following dependency: <dependency> <groupId>de.app.test</groupId> <artifactId>foo</artifactId> <version>1.0.0</version> </dependency> This artifact exist also in two version bar-1.0.0.jar and bar-1.0.0-client.jar I want to make bar-1.0.0-client.jar dependent of foo-1.0.0-client.jar and bar-1.0.0.jar dependent of foo-1.0.0.jar . ================ ->First (wrong) solution: define the scope as provided and use the right foo package when using bar.jar ->Second (long) solution : Add