Is there an equivalent to codehaus' plugin's <xsdPathWithinArtifact> for the maven-jaxb2-plugin? - jaxb

jaxb2-maven-plugin has the <xsdPathWithinArtifact> option. Is there an equivalent in maven-jaxb2-plugin? What is the recommended way to include the schema file in the produced jar? I'm currently using Maven's native <resources>.

Disclaimer: I'm the author of the maven-jaxb2-plugin.
No, there is no such option in maven-jaxb2-plugin and there will not be. Managing resources is not the concern of maven-jaxb2-plugin, there are other Maven plugins for that.
The recommended way is exactly what you're doing - place your schemas under src/main/resources and they will be packaged in the resulting JAR.

Related

Do I need to update log4j.properties file if I use the Log4j 1.x bridge (log4j-1.2-api)

I've followed the doc here : https://logging.apache.org/log4j/2.x/manual/migration.html
Also looked at https://logging.apache.org/log4j/2.x/manual/configuration.html#Properties
My existing log4j.properties only uses DailyRollingFileAppender, ConsoleAppender, both of which are under the 'Supported Components', so I shouldn't be forced to convert my log4j.properties file into log4j2.properties format. I'm not accessing methods and classes internal to the Log4j 1.x implementation, as suggested by the document.
For using the bridge, I previously was using both log4j1.compatibility and log4j.configuration, but the document suggests using 'any one' (tried using just one, doesn't work)
I can build my application successfully, however, my application no longer logs anything. What am I missing?
You may want to consider reload4j as a drop-in replacement for log4j 1.x. Initiated by Ceki Gülcü, the original author of Apache log4j 1.x, the reload4j project is a fork of Apache log4j version 1.2.17 with the goal of fixing pressing security issues.
The reload4j project offers a clear and easy migration path for the users who have an urgent need to fix vulnerabilities in log4j 1.2.17.
You don't need to update your properties file.
You can add a log4j2.component.properties file on the class path (in my case, in the same directory as my log4j.properties file) to set the log4j1.compatibility property, like this:
log4j1.compatibility=true
In our case, it only required setting the compatibility property and then it automatically picked up the log4j.properties file that was available on the class path.
Figured it out.
The answer lied in the Automatic Configuration section

Schemacrawler in OSGi bundle

I'm really new to Schemacrawler and I need a little help. I want to use Schemacrawler as OSGi bundle in my project. However I'm not sure how to do it. In the Readme, it says that "The SchemaCrawler jar file is bundled as an OSGi bundle". But there are a lot of schemacrawlers jars in the Maven repo. Which one should I use?
Another question is, I tried to import only the schemacrawler jar into my project, and did a little test with sqlite. It did work nicely, however I'm wondering do I need to include all other the database specific jars (e.g schemacrawler-sqlite) as well? What are they for actually? thanks!
Eli,
Here is a resource on OSGi in Java: OSGi Modularity - Tutorial. You should use the latest version of the main SchemaCrawler jar. If you are using SQLite, you should also use the corrsponding version of SchemaCrawler for SQlite jar. The SchemaCrawler for SQlite jar provides additional functionality specifically for SQLite.
Sualeh Fatehi, SchemaCrawler

How to add dependencies in hybris using external-dependencies.xml file?

I'm newbie in hybris. I want to add maven dependency in hybris using external-dependencies.xml. But I can't see any of those jar(s) popped-in. Is it possible to get jar using external-dependencies.xml, if yes, please provide your response.
The platform build is coupled with ant but you can use maven dependency (by default is disabled because all necessary libraries are shipped with the hybris).
In order to activate dependency management you have to follow these steps:
1) Make sure you have maven installed
2) Open the extensioninfo.xml from your extension
2.1) Include usemaven="true", for instance
3) Manage your dependencies inside "external-dependencies.xml" file (Inside this file is a regular maven pom.xml)
4) build your project (ant all). Hybris fetch required libraries into \lib and \web\webroot\WEB-INF\lib (Bear in mind that there are two "external-dependencies.xml", one for the core module and other for the web module)
Besides if you look the ant targets you will see there is one call "updateMavenDependencies". This task delete all jars in the lib folder and replaces them with the defined maven dependencies. In case you dont want maven to manage a few libraries you can handle this, creating a file in the root of your extension call "unmanaged-dependencies.txt".On this file you will include all libraries maven is not going to manage (therefore the ant target is not going to delete the libraries include on this file)
My official answer: add usemaven="true" in your extensioninfo.xml (extension tag)
I'm newbie too to Hybris but what I know is that whenever you need a dependency in a Hybris extension you need to add the name of the dependency to hybris/config/localextensions.xml and in extensioninfo.xml in the extension you want to add the dependency.
As for the Maven dependency, I'm not sure how to do that because I mostly use the out-of-the-box build system which is based on Ant.

log4j extras in OSGi environment

I want to use the log4j-extras-1.1.jar in OSGi environment (Fuse Fabric 7.1.0.fuse-047)
so that I can use archive feature of org.apache.log4j.rolling.RollingFileAppender
What are simplest steps to achieve that?
It can't easily be done, and you actually don't need it. The used Pax-Logging provides a ZippedRollingFile appender out-of-the-box:
org.apache.log4j.zip. ZipRollingFileAppender

Creating own groovy library

Do anyone have an idea whats the best way of creating an own library for groovy.
I have several methods which i just dont want copy and paste into all my groovy scripts.
The perfect solution would be to do it by an
import myownmethods
How to create the library myownmethods.jar?
Thanks for any answer and solution
Cheers
The simplest method is to compile your groovy files with groovyc and then package them into a jar file with jar. For example:
groovyc -d classes myclasses.groovy
jar cvf myclasses.jar -C classes .
I'd also consider looking at gradle. To get started, you can use a build.gradle containing just:
apply plugin: 'groovy'
Then put your source files in a subdirectory called src/main/groovy and run gradle jar. It will build your source files into a jar file in build/libs.
You should follow the same process that you would for a Java library, i.e.
Create a project for the code
Configure your favorite build tool (Ant, Maven, etc.) to build a JAR for that project
Put the JAR somewhere where other projects can find it. If you're using a tool like Ivy or Maven that does dependency management you'll likely want to deploy it to a repository. Otherwise, you can probably just put it somewhere in source control †
Projects that depend on this library should either load it from the repository (if using dependency management), or have it copied into their lib directory (if not) †
† I know this sucks, but I can't remember how I used to manage dependencies without using a dependency management tool

Resources