How to change the template for autogenerated pom.xml file in Eclipse maven - pom.xml

Whenever I create a new Maven project in Eclipse Juno, it creates a pom.xml file by default. The file has got some dependencies e.g. Junit 3.8.1 I'd like to change the template for this autogenerated file so the dependency created is for JUnit 4 not JUnit3 by default.

Related

Missing grails 3.3 plugin jar gson view class files

Grails 3.3. I render gson views in a plugin. During plugin stand-alone run-app the views render fine as expected. After including the plugin in a main app the views cannot be resolved. I notice that the published plugin jar has no compiled gson class files in it, only the source gson files. Shouldn't there be gson class files in the jar? There is no gradle "compileGsonViews" task in the plugin app. Also, in Intellij the "build Artifacts" action is disabled. Shouldn't there also be a jar file artifact? Am I missing something in my build dependencies? The only "views" line in build.gradle is
compile "org.grails.plugins:views-json:1.2.6"
Indeed I was missing some things in build.gradle. I was missing:
buildscript {
dependencies {
classpath "org.grails.plugins:views-gradle:1.2.6"
}
}
apply plugin: "org.grails.plugins.views-json"
I should add that this does cause the gson class files to be included in the jar file. However, it has no effect on the larger issue of the inability to resolve the plugin view classes when running the main application.

How to exclude grails plugin jar from war file

Grails 3.2.5. Build.gradle has mail plugin:
compile "org.grails.plugins:mail:2.0.0.RC6"
In deploying a war to production I need to remove javax.mail-1.5.6.jar from WEB-INF/lib since that jar must be in the Tomcat lib when using a JNDI mail resource. So how do I keep the mail plugin but remove the offending jar file from the war? I knew how to do this in Grails 2.x. Via the gradle war task in build.gradle I have tried to exclude the file (doesn't work - the jar drifts in from a plugin somehow), and have tried to filter the file out. When I build the war I get two files - "app-0.1.war" and "app-0.1.war.original". The "original" file has the WEB-INF/lib/javax.mail jar filtered out, but the real, complete war still has it.
So how do I prevent that plugin jar from getting into the war file? Thanks.
One way to do it is with something like this:
war {
rootSpec.exclude '**/javax.mail*.jar'
}
(you may need to adjust depending on whether or not you want to also exclude the javax.mail-api jar file along with the javax.mail jar)
See https://github.com/jeffbrown/excludejar/blob/67734ac0c65cdbead468f1e65bcfc29041cd2279/build.gradle#L70-L72

No POM for multimodule project

While releasing a project I am getting below error in jenkins. I have multimodule project where one directory contains 5 projects and each project has its own pom.xml. I have created a 6th project to create EAR ( using 5 projects binaries) and this ear needs to be checked in repository.
The goal you specified requires a project to execute but there is no POM in this directory (/dev/shm/jenkinsworkspaces/Project_EAR_Build/workspace/Project_EAR_Build/target/checkout.). Please verify you invoked Maven from the correct directory.
I have specify goal in jenkins job as -Dresume=false release:prepare release:perform.
What should I mention in goal so that maven will refer checkout/EAR_Project directory to locate
pom.xml instead of checkout directory ?

Maven Assembly Plugin and Executable jar

I'm able to successfully build the Maven assembly plugin in my project and generate a jar file with all the needed dependencies. But now I also want to instruct Maven after building me the jar file with dependencies, go into the target folder where the jar file with dependencies is located and run my main program.
Should I consider looking into the Maven Exec Plugin for what I want to acheive?
Yes the exec-maven-plugin is the right choice. The question is if you like to start the assembled jar archive or just a java class with it's dependencies.

Referencing external dependencies in GGTS by convention

How do I reference a dependency by convention within my project build path? Allow me to elaborate...
I'm using the Groovy/Grails Tool Suite (GGTS 3.0). I'm referencing the dependency as such in my BuildConfig.groovy:
dependencies {
compile 'tgt:jaxb-utils:1.0'
}
The referenced jar file is successfully pulled down from the Artifactory repo - I can find the jar file on my local file system in the Ivy cache. When I run any grails targets (grails compile, grails run-app, grails run-tests), it works fine - meaning my code that imports the classes from the jar has no problems. When I run grails war, the referenced jar file is packed into the constructed war.
However, and here is the crux of this post - the project build path does not reference this jar file by default or convention, so my java or groovy code that imports the classes from the jar file reports a unable to resolve class ... error.
One solution is to simply add the jar file to the lib folder and update the build path accordingly, or modify the build path to reference the jar file in the Ivy cache folder. However, I'd have to do this for any/all dependencies pulled down in this way. Any jars in the lib folder will get saved to the team source code repository, and that seems like wasted space since the grails commands work fine with just the dependency reference in BuildConfig.groovy.
Am I just being too idealistic (ie - difficult) here, or is there a better way to clean up the unable to resolve class ... errors in my IDE without having to manually add the dependent jar files to my lib folder and update my build path? Ideas?
Eclipse / STS / GGTS : If you have Grails plugin installed, you can do the following :
Right click on your project -> Grails Tools -> Refresh dependencies (or shortcut "Alt+G, R")

Resources