How do you include resources files in Maven site source cross reference? - maven-2

Especially of interest are the configuration xml files that are so common.
I'd hope there was a configuration to the JXR plugin. I tried */.xml but that didn't work.

It looks like Maven JXR plugin does provide a way to include/exclude files though not sure if it is just .java files.
You should try **/*.xml rather than */*.xml
<includes>
<include>**/*.xml</include>
</includes>

Related

Maven update jar before packaging in WAR

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>

Maven replacer plugin - Output directory

I'm using maven replacer plugin http://code.google.com/p/maven-replacer-plugin/ with below configuration
<configuration>
<includes>
<include>api/**/*.java</include>
</includes>
<token>#Start.*?#End</token>
<value></value>
<regexFlags>
<regexFlag>DOTALL</regexFlag>
</regexFlags>
<outputBasedir>publicapi</outputBasedir>
</configuration>
My project structure is api/src/main/java/...xxx.java. I want replacer plugin to generate files in this structure - publicapi/src/main/java/...xxx.java whereas with current configuration, plugin generates files like this -publicapi/api/src/main/java/...xxx.java
I don't want "api" directory in between. Is there any property available in this plugin which can solve my problem.
Based on the docs it looks like outputDirectory is what you are searching for.

pack stuff other than target/classes with maven jar

I am using maven jar plugin to package the jar file. But it looks like maven jar plugin just only pack the stuff that stay inside target/classes. I am also want to pack all the classes in target/classes and (resource and class) files from many other directories. How can i do that with maven jar?
The resource files stays in another folder of project.
If you can't (or just don't want to) put them under src/main/resources, you can declare additional resource locations using the <resource> element:
<project>
...
<build>
...
<resources>
<resource>
<directory> [your folder here] </directory>
</resource>
</resources>
...
</build>
...
</project>
See Specifying resource directories.
The other classes are generated classes.
The convention with plugins generating sources it to generate them in target/generated-sources/<tool> and a well implemented plugin should add the specified path as a source directory (so that generated code would be compiled). When they don't, the Build Helper Maven Plugin can come to the rescue.
If you are generating classes, why don't you generate them in ${project.build.outputDirectory} (i.e. target/classes by default)? I don't think you can add a 2nd classes directory anyway.
If this doesn't help, please clarify your exact constraints and requirements.
References
Specifying resource directories
MavenPropertiesGuide

Using <fileSets> with Maven assemblies

I am trying to add specific directories from Maven modules into my build. I believe that fileSets are the way to go back this.
I would appreciate a clear and concise way of using fileSets to obtain necessary directories from Maven modules that just simply contain a directory with some necessary resources.
If you want to include entire modules, use moduleSets, but if you want to pick and choose which files to add you can use fileSets in an assembly config file from the top level project like this:
<fileSets>
<fileSet>
<directory>${basedir}/myModule/src/main/resources</directory>
<includes>
<include>*.txt</include>
</includes>
</fileSet>
</fileSets>

Stranges files in my assembly since switching to <lineEnding>unix</lineEnding>

since I've inserted the option <lineEnding>unix</lineEnding> into my fileSets and files in my Maven assembly plugin configuration, strange files are placed in my tar.
They look as following:
ignore.me.1499711160.filtered.903528596.formatted
run.sh.2124782621.filtered.1130667884.formatted
Do you know why this occurrs?
This is a bug captured in MASSEMBLY-462. Either patch the plugin with the attached patch or revert to a previous version (try with 2.2-beta-4).
I had the same problem i used excludes tag in the assembler, you can use it in pom too:
<fileSet>
<directory>DEV</directory>
<outputDirectory>${file.separator}FileName${file.separator}DEV</outputDirectory>
<useDefaultExcludes>true</useDefaultExcludes>
<lineEnding>unix</lineEnding>
<excludes>
<exclude>*.formatted</exclude>
</excludes>
</fileSet>