Giter VIP home page Giter VIP logo

eclipselink-static-weave-plugin's Introduction

Introduction

Plugin which performs Eclipselink static weaving. Use the weave goal to execute.

Heavily inspired by https://code.google.com/p/eclipselink-staticweave-maven-plugin. This is an updated and enhanced version to be compatible with Java 7 + 8, Maven 3.x and EclipseLink 2.5.1.

Internally the StaticWeaveProcessor is used, like described in the EclipseLink Wiki https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving#Use_the_Command_Line.

Do not forget to add EclipseLink as dependency, otherwise the EclipseLink StaticWeaveProcessor is not found.

Common Usage

 <build>
   	...
   <plugins>
 			 <plugin>
 			 	<groupId>de.empulse.eclipselink</groupId>
 				<artifactId>staticweave-maven-plugin</artifactId>
 				<version>1.0.0</version>
 				<executions>
 					<execution>
 						<phase>process-classes</phase>
 						<goals>
 							<goal>weave</goal>
 						</goals>
 						<configuration>
 							<persistenceXMLLocation>META-INF/persistence.xml</persistenceXMLLocation>
 							<logLevel>FINE</logLevel>
 						</configuration>
 					</execution>
 				</executions>
 				<dependencies>
 					<dependency>
 						<groupId>org.eclipse.persistence</groupId>
 						<artifactId>org.eclipse.persistence.jpa</artifactId>
 						<version>${eclipselink.version}</version>
 					</dependency>
 				</dependencies>
 			</plugin>
   		
   		...
   	</plugins>
   	...
 </build>

Plugin Options

persistenceXMLLocation

Give here the location of your persistence.xml file. This property is optional. If not set the default location META-INF/persistence.xml is used.

source

The location of the JPA classes. This property is optional, default value is ${project.build.outputDirectory}.

target

The location for the weaved classes. This property is optional, default value is ${project.build.outputDirectory}.

logLevel

The Logging level of the used EclipseLink StaticWeave class. This property is optional, default value is FINE to get informed which JPA classes were woven.

Possible values:

  • OFF
  • SEVERE
  • WARNING
  • INFO
  • CONFIG
  • FINE
  • FINER
  • FINEST
  • ALL

The EclipseLink logging information is always given in Maven INFO loglevel.

Happy weaving!

eclipselink-static-weave-plugin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eclipselink-static-weave-plugin's Issues

Signer information does not match signer information of other classes in the same package

Execution default of goal de.empulse.eclipselink:staticweave-maven-plugin:1.0.0:weave failed: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.7.1.v20171221-bd47e8f): org.eclipse.persistence.exceptions.EntityManagerSetupException [ERROR] Exception Description: Predeployment of PersistenceUnit [corpo-flow] failed. [ERROR] Internal Exception: java.lang.SecurityException: class "javax.persistence.AttributeConverter"'s signer information does not match signer information of other classes in the same package

Error occurs with EclipseLink 2.7.1

the persistenceXMLLocation value is relative to the project target directory.

The <persistenceXMLLocation> value is relative to the project target directory, presumably the <source> value. This in itself is a bit surprising (might be documented better) but I also cannot use an absolute value in this location, like ${project.basedir}/../ejb/src/main/resources to go to another project.
If not solvable (I saw in the code that this value is directly passed to an eclipselink method) maybe the documentation can be improved?

Failed to execute goal de.empulse.eclipselink:staticweave-maven-plugin:1.0.0:weave

Getting below exception while doing build though eclipselink dependencies are there. am executing in OSGi environment. am using eclipselink 2.5.2.
[ERROR] Failed to execute goal de.empulse.eclipselink:staticweave-maven-plugin:1.0.0:weave (default) on project ews.voucher.bundle: Execution def
ault of goal de.empulse.eclipselink:staticweave-maven-plugin:1.0.0:weave failed: A required class was missing while executing de.empulse.eclipsel
ink:staticweave-maven-plugin:1.0.0:weave: org/eclipse/persistence/exceptions/StaticWeaveException

Plugin execution not covered by lifecycle configuration

I'm run Eclipse IDE for Enterprise Java Developers (includes Incubating components) on Windows (x64):
Version: 2020-12 (4.18.0)
Build id: 20201210-1552
If I open the project .pom file in "Overview" tab we get this hint displayed on top of the window:

Plugin execution not covered by lifecycle configuration: de.empulse.eclipselink:staticweave-maven-plugin:1.0.0:weave (execution: default, phase: process-classes)

The plugin pom section in question we use:

 ... <eclipselink.version>2.7.6</eclipselink.version> ...

<plugin>
<groupId>de.empulse.eclipselink</groupId>
  <artifactId>staticweave-maven-plugin</artifactId>
  <version>1.0.0</version>
  <executions>
	<execution>
		<phase>process-classes</phase>
		<goals>
			<goal>weave</goal>
		</goals>
		<configuration>
			<persistenceXMLLocation>META-INF/persistence.xml</persistenceXMLLocation>
			<logLevel>FINE</logLevel>
		</configuration>
	</execution>
  </executions>
  <dependencies>
	<dependency>
		<groupId>org.eclipse.persistence</groupId>
		<artifactId>org.eclipse.persistence.jpa</artifactId>
		<version>${eclipselink.version}</version>
	</dependency>
  </dependencies>
</plugin>

As I can remember with Eclipse 2020-09 the static weaving also did not applied (without the warning in IDE) on build, I always have to go through external command "mvn install" for the (sub-) project.

So. why is it ignored? What I have to do to get it considered and run?

Some goals are not marked @threadSafe

When I run mvn -T 2 clean install on my project maven prints:

[WARNING] *****************************************************************
[WARNING] * Your build is requesting parallel execution, but project      *
[WARNING] * contains the following plugin(s) that have goals not marked   *
[WARNING] * as @threadSafe to support parallel building.                  *
[WARNING] * While this /may/ work fine, please look for plugin updates    *
[WARNING] * and/or request plugins be made thread-safe.                   *
[WARNING] * If reporting an issue, report it against the plugin in        *
[WARNING] * question, not against maven-core                              *
[WARNING] *****************************************************************
[WARNING] The following plugins are not marked @threadSafe in model:
[WARNING] de.empulse.eclipselink:staticweave-maven-plugin:1.0.0
[WARNING] Enable debug to see more precisely which goals are not marked @threadSafe.
[WARNING] *****************************************************************

It seems the build is working anyway, but could you please fix/improve that?

Kind regards,
Fabian

EclipseLink: static weaving, inheritance and OSGi

I use eclipselink 2.6.3. And I have two classes:

@Entity
class ClassA extends ClassB{...}

@MappedSuperclass
class ClassB{...}

And I do static weaving using maven-plugin:

       <plugin>
           <groupId>de.empulse.eclipselink</groupId>
           <artifactId>staticweave-maven-plugin</artifactId>
           <version>1.0.0</version>
           <executions>
               <execution>
                   <phase>process-classes</phase>
                   <goals>
                       <goal>weave</goal>
                   </goals>
                   <configuration>
                       <persistenceXMLLocation>META-INF/persistence.xml</persistenceXMLLocation>
                       <logLevel>ALL</logLevel>
                   </configuration>
               </execution>
           </executions>
           <dependencies>
               <dependency>
                   <groupId>org.eclipse.persistence</groupId>
                   <artifactId>org.eclipse.persistence.jpa</artifactId>
                   <version>${eclipselink.version}</version>
               </dependency>
           </dependencies>
       </plugin>

When ClassA and ClassB are in the same bundle weaving works. However, when they are in different bundles/project weaving doesn't work (although I added this plugin to both bundles/projects). How to fix this problem?

Compile Error during Weaving

I get below Errors when I updated the maven plugin. I think the static weaver is unable to find these classes? Any help is valuable.

[ERROR] Processor.java:[253,59] error: cannot access PersistenceWeaved
[ERROR]   class file for org.eclipse.persistence.internal.weaving.PersistenceWeaved not found
[ERROR] Processor.java:[253,33] error: cannot access PersistenceEntity
[ERROR]   class file for org.eclipse.persistence.internal.descriptors.PersistenceEntity not found
[ERROR] Processor.java:[247,48] error: cannot access PersistenceObject
[ERROR]   class file for org.eclipse.persistence.internal.descriptors.PersistenceObject not found
[ERROR] Processor.java:[266,33] error: cannot access FetchGroupTracker
[ERROR]   class file for org.eclipse.persistence.queries.FetchGroupTracker not found
[ERROR] Processor.java:[272,51] error: cannot access PersistenceWeavedFetchGroups
[ERROR]   class file for org.eclipse.persistence.internal.weaving.PersistenceWeavedFetchGroups not found
[ERROR] Processor.java:[279,70] error: cannot access PersistenceWeavedRest
[ERROR]   class file for org.eclipse.persistence.internal.weaving.PersistenceWeavedRest not found
[ERROR] ServiceUtil.java:[138,32] error: cannot access ChangeTracker
[ERROR]   class file for org.eclipse.persistence.descriptors.changetracking.ChangeTracker not found
[ERROR] ServiceUtil.java:[139,32] error: cannot access PersistenceWeavedChangeTracking

Plugin execution not covered by lifecycle configuration

It works just fine in NetBeans but I cannot make it work in Eclipse. It says:

Plugin execution not covered by lifecycle configuration: de.empulse.eclipselink:staticweave-maven-plugin:1.0.0:weave (execution: default, phase: process-classes)

I am using Eclipse Mars.2 Release (4.5.2) and EclipseLink 2.6.1

I uploaded the pom.xml as a text file: pom.xml.txt

I would really appreciate your help to solve this problem.

Woven JPA classes not logged

I'm using the exact configuration from the front page (and the eclipselink Wiki[1], for that matter) and my entities seem to get woven properly, but I see no log messages indicating what was woven.

Maven prints:

[INFO] --- staticweave-maven-plugin:1.0.0:weave (default) @ maven-project ---
[INFO] Start EclipseLink static weaving...
[INFO] Finished EclipseLink static weaving.

The output doesn't change with -X, nor with <logLevel>ALL</logLevel>.

[1] https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.