Maven Hibernate bytecode enhancement not working - spring

I'm trying to add Bytecode Enhancement to my Maven Spring project created with Spring Initializr, so that I can use lazyloading in a #Formula, whoever, it's not working
I've added the plugin to the build > plugins section of my pom.xml:
<plugin>
<groupId>org.hibernate.orm.tooling</groupId>
<artifactId>hibernate-enhance-maven-plugin</artifactId>
<version>${hibernate.version}</version>
<executions>
<execution>
<configuration>
<failOnError>true</failOnError>
<enableLazyInitialization>true</enableLazyInitialization>
<enableDirtyTracking>false</enableDirtyTracking>
<enableAssociationManagement>false</enableAssociationManagement>
<enableExtendedEnhancement>false</enableExtendedEnhancement>
</configuration>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
If I run the goal manually, I get the following warning:
[WARNING] Skipping Hibernate bytecode enhancement plugin execution since no feature is enabled
I saw only one other mention of this problem on the internet, and they said that it was probably a configuration problem with Maven, because the plugin is not able to read those properties on the .xml, but what could I do? This is basically a fresh Spring Initializr project.

Related

While creating a Maven project using archetype13, I have faced Sling IDE issues for core and test pom.xml

while creating a maven project using archetype13, I have faced Sling IDE issues as below for core and test pom.xml
This is the error that I get:
"Missing m2e incremental build support for generating the bundle manifest, component descriptions and metatype resources.
Please use the provided Quick Fixes on this issue to resolve this. pom.xml /AEMEditable.core line 1 Bundle Project Not Supporting M2E"
Note: Figured out how to solve this.
We need to manually modify the pom.xml for core and test, under maven-bundle plugin.
For both core and test pom.xml add the following code :
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<!-- Configure extra execution of 'manifest' in process-classes phase
to make sure SCR metadata is generated before unit test runs -->
<execution>
<id>scr-metadata</id>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<supportIncrementalBuild>true</supportIncrementalBuild>
</configuration>
</execution>
</executions>
<configuration>
<instructions>
<!-- Import any version of javax.inject, to allow running on multiple versions of AEM -->
<Import-Package>javax.inject;version=0.0.0,*</Import-Package>
<Sling-Model-Packages>
AEMEditable.core
</Sling-Model-Packages>
<!-- Enable processing of OSGI DS component annotations -->
<_dsannotations>*</_dsannotations>
<!-- Enable processing of OSGI metatype annotations -->
<_metatypeannotations>*</_metatypeannotations>
</instructions>
<exportScr>true</exportScr>
</configuration>
</plugin>
Check image:
Once this is done, select the whole project in eclipse, right click, Click on Maven --> Update Project

Swagger CodeGen Dependency Issues

I'm trying to get a project up and running with Swagger codegen Maven plugin. I have the following plugin in my pom.xml.
<build>
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.0-rc1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>
<language>spring</language>
<configOptions>
<sourceFolder>src/gen/java/main</sourceFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
When I run mvn clean compile, I get a bunch of dependency errors. For example, fasterxml and threeten. I'm surprised that the dependencies wouldn't be automatically configured and that everything would work out of the box. Am I doing something wrong or do you really need to manually add the dependencies to pom.xml?
UPDATE
While digging through the code, I noticed there is a generated pom.xml (target/generated-sources/swagger with my config above) that seems to have the dependencies I need. Googling led to an issue thread concerning my problem. Looks like this is potentially a known issue.
The dependency copying worked when I used <language>jaxrs-resteasy</language> but I'm still working on other use cases (the spring I originally had and also jaxrs-jersey).

Are directions available for the maven plugin com.alexnederlof jasperreports-plugin?

I have read up on the limited information regarding com.alexnederlof jasperreports-plugin and I'm looking to convert my current ant build to use this maven plugin, but there doesn't seem to be any documentation available.
My biggest concern is run-time: If I use this plugin at build-time, what version of jasper-reports do I need to use at run-time?
Am I missing a reference somewhere? As the old adage goes, "If there isn't any documentation, then I guess I'll have to write it."
I am not sure of what you are after but, I am using this plugin in maven to generate the source .jrxml files to .jasper files and the configuration in pom goes like this:
<plugin>
<groupId>com.alexnederlof</groupId>
<artifactId>jasperreports-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>jasper</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- These are the default configurations: -->
<compiler>net.sf.jasperreports.engine.design.JRJdtCompiler</compiler>
<sourceDirectory>src/main/jasperreports</sourceDirectory>
<outputDirectory>${basedir}/src/main/webapp</outputDirectory>
<outputFileExt>.jasper</outputFileExt>
<xmlValidation>true</xmlValidation>
<verbose>false</verbose>
<numberOfThreads>4</numberOfThreads>
<failOnMissingSourceDirectory>true</failOnMissingSourceDirectory>
<sourceScanner>
org.codehaus.plexus.compiler.util.scan.StaleSourceScanner
</sourceScanner>
</configuration>
</plugin>
Hope this helps

aspectj-maven-plugin not covered by lifecycle in Kepler

I've just downloaded the OEPE (Kepler) and installed m2e and m2e-wtp connectors.
I found out that under this path: Preferences ->Maven->Lifecycle mappings->Open workspace lifecycle mapping data there is a preconfigured xml file which says that maven should ignore the compile goal for AspectJ and I assume that's why the AspectJ runtime libraries are not added to the project hence the project is not recognized as an AspectJ project by eclipse.
<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<versionRange>1.6</versionRange>
<goals>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
I commented out these lines in the xml file and reloaded it once again.
Now the IDE does not ignore AspectJ plugin tag in the lifecycle but pom file is complaining that it cannot recognize the execution tag.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
Using indigo the m2e-wtp was able to recognize the <execution> tag for aspectj plugin and able to add the AspectJ runtime libraries
automatically to the project, though this is not the case in Kepler. (I think it is m2e-wtp's job to make an AspectJ project out of the pom but not quite sure.)
Btw. the how can I make things work like in Indigo?
I know I can right click on the project and convert it to aspect project in order to solve the problem but I want the IDE and plugins realize from the pom file that this project needs AspectJ jars. Any idea?
This is how I got it working, first verify you have installed AJDT support by installing "AspectJ Development Tools (AJDT)" and "AspectJ compiler for Eclipse" from the AJDT update site: http://download.eclipse.org/tools/ajdt/43/update
You can do this through the "Help / Install new software" menu item.
Then, install the M2E connector manually by installing AJDT M2E using this update site:
http://dist.springsource.org/release/AJDT/configurator/

Eclipse, WebSphere7.0, Maven: AspectJ does not weave code during hot deployment

My System Information:
IDE: Eclipse Blue 10.0,
Server: Websphere 7.0
Build Management Tool: Maven 3.0
I perform compile time weaving in my Maven project using below configuration:
<properties>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<!-- <goal>test-compile</goal> -->
</goals>
</execution>
</executions>
<configuration>
<aspectLibraries>
<aspectLibrary>
<groupId>com.xxx.logger</groupId>
<artifactId>my-aspect-logger</artifactId>
</aspectLibrary>
</aspectLibraries>
<showWeaveInfo>true</showWeaveInfo>
<outxml>true</outxml>
<Xlint>warning</Xlint>
<verbose>true</verbose>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
</plugins>
</build>
During development, I use to add my EAR file in exploded mode in Eclipse itself by following below path:
Windows > Show View > Servers > WebSphere 7 > Right Click > Add Deployment
I am facing one issue that whenever I change my java classes those are compiled and hot deployed in server. But, they are not re-weaved. But if I remove the EAR, build my project from command prompt and re-deploy it then it works properly.
Can somebody please help me to resolve this issue.
I'm not familiar with AspectJ but MyEclipse does not execute maven goals to build and deploy projects (though you can add builders, which may invoke maven externally - note that the Maven Project Builder doesn't execute Maven goals), so processing specified in your pom will not be executed automatically, though, obviously, you can run maven goals from the Run As menu item. So changed Java classes will be recompiled using the configured JRE and redeployed. Any additional processing specified in the pom will not be run. However, you say that removing the deployment and then re-deploying actually works, so I'm not sure how the re-weaving gets done, if you don't execute a maven build before redeployment.

Resources