Skip to content

Commit b8af988

Browse files
Develop System 01Develop System 01
authored andcommitted
initial commit
0 parents  commit b8af988

File tree

17 files changed

+797
-0
lines changed

17 files changed

+797
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"java.configuration.updateBuildConfiguration": "disabled"
3+
}

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
2+
# Example project JPA
3+
4+
* GraalVM/Native Image
5+
* ORM
6+
* Eclipse Link
7+
8+
https://www.graalvm.org/22.2/reference-manual/native-image/guides/use-native-image-maven-plugin/
9+
10+
Compile to standard jvm.
11+
12+
```
13+
mvn clean package
14+
15+
java -jar target/jpaEntityManager.jar
16+
17+
java -jar target/jpaEntityManager-jar-with-dependencies.jar
18+
```
19+
20+
## Collect info
21+
22+
```
23+
mvn clean package
24+
25+
mvn -Pnative -Dagent exec:exec@java-agent
26+
```
27+
28+
### Generate files in folder
29+
30+
> target/native/agent-output/main/
31+
32+
## Compile using graalvm/native-image
33+
34+
```
35+
mvn -Pnative -Dagent package
36+
```
37+
38+
## Run the native project executable (Assuming you are in root folder of the project)
39+
40+
target/jpaEntityManager
41+
42+
## Reference images
43+
44+
Vs Code Enviroment 01
45+
![vs_code_01](others/images/vs_code_01.png)
46+
47+
Vs Code Enviroment 02
48+
![vs_code_02](others/images/vs_code_02.png)
49+
50+
Vs Code Enviroment 03
51+
![vs_code_03](others/images/vs_code_03.png)
52+
53+
Vs Code Enviroment 04
54+
![vs_code_04](others/images/vs_code_04.png)

_pom.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>com.logicbig.example</groupId>
7+
<artifactId>jpa-kickstart-example</artifactId>
8+
<version>1.0-SNAPSHOT</version>
9+
10+
<dependencies>
11+
12+
<!-- https://mvnrepository.com/artifact/com.mysql/mysql-connector-j -->
13+
<dependency>
14+
<groupId>com.mysql</groupId>
15+
<artifactId>mysql-connector-j</artifactId>
16+
<version>8.0.31</version>
17+
</dependency>
18+
19+
<!-- <dependency>
20+
<groupId>com.h2database</groupId>
21+
<artifactId>h2</artifactId>
22+
<version>2.1.214</version>
23+
</dependency> -->
24+
25+
<dependency>
26+
<groupId>org.eclipse.persistence</groupId>
27+
<artifactId>eclipselink</artifactId>
28+
<version>3.0.2</version>
29+
</dependency>
30+
31+
<dependency>
32+
<groupId>org.eclipse.persistence</groupId>
33+
<artifactId>javax.persistence</artifactId>
34+
<version>2.2.1</version>
35+
</dependency>
36+
</dependencies>
37+
38+
<build>
39+
<plugins>
40+
<plugin>
41+
<groupId>org.apache.maven.plugins</groupId>
42+
<artifactId>maven-compiler-plugin</artifactId>
43+
<version>3.5.1</version>
44+
<configuration>
45+
<source>17</source>
46+
<target>17</target>
47+
<encoding>UTF-8</encoding>
48+
</configuration>
49+
</plugin>
50+
51+
52+
</plugins>
53+
</build>
54+
</project>

others/images/mysql_platform.png

332 KB
Loading

others/images/vs_code_01.png

356 KB
Loading

others/images/vs_code_02.png

371 KB
Loading

others/images/vs_code_03.png

337 KB
Loading

others/images/vs_code_04.png

274 KB
Loading

pom.xml

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
<project
2+
xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<groupId>com.jpa.example</groupId>
7+
<artifactId>jpaEntityManager</artifactId>
8+
<version>0.0.1</version>
9+
<packaging>jar</packaging>
10+
<name>jpaEntityManager</name>
11+
<url>http://maven.apache.org</url>
12+
13+
<properties>
14+
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
<native.maven.plugin.version>0.9.18</native.maven.plugin.version>
17+
<!-- <junit.jupiter.version>5.8.1</junit.jupiter.version>
18+
<maven.compiler.source>${java.specification.version}</maven.compiler.source>
19+
<maven.compiler.target>${java.specification.version}</maven.compiler.target> -->
20+
<nativeImageName>${project.name}</nativeImageName>
21+
<mainClass>com.jpa.example.Application</mainClass>
22+
23+
</properties>
24+
25+
<dependencies>
26+
27+
<!-- MySQL connector -->
28+
<dependency>
29+
<groupId>com.mysql</groupId>
30+
<artifactId>mysql-connector-j</artifactId>
31+
<version>8.0.31</version>
32+
</dependency>
33+
34+
<dependency>
35+
<groupId>org.eclipse.persistence</groupId>
36+
<artifactId>eclipselink</artifactId>
37+
<version>4.0.0</version>
38+
</dependency>
39+
40+
<dependency>
41+
<groupId>org.eclipse.persistence</groupId>
42+
<artifactId>org.eclipse.persistence.json</artifactId>
43+
<version>4.0.0</version>
44+
</dependency>
45+
46+
<!-- https://mvnrepository.com/artifact/jakarta.validation/jakarta.validation-api -->
47+
<dependency>
48+
<groupId>jakarta.validation</groupId>
49+
<artifactId>jakarta.validation-api</artifactId>
50+
<version>3.0.2</version>
51+
</dependency>
52+
53+
<!-- Test -->
54+
<dependency>
55+
<groupId>junit</groupId>
56+
<artifactId>junit</artifactId>
57+
<version>3.8.1</version>
58+
<scope>test</scope>
59+
</dependency>
60+
61+
</dependencies>
62+
63+
<build>
64+
<sourceDirectory>src/main/java</sourceDirectory>
65+
<finalName>${project.name}</finalName>
66+
<plugins>
67+
68+
<plugin>
69+
<artifactId>maven-compiler-plugin</artifactId>
70+
<version>3.5.1</version>
71+
<configuration>
72+
<source>17</source>
73+
<target>17</target>
74+
</configuration>
75+
</plugin>
76+
77+
<plugin>
78+
<artifactId>maven-dependency-plugin</artifactId>
79+
<executions>
80+
<execution>
81+
<phase>prepare-package</phase>
82+
<goals>
83+
<goal>copy-dependencies</goal>
84+
</goals>
85+
<configuration>
86+
<outputDirectory>${project.build.directory}/libs</outputDirectory>
87+
<overWriteReleases>false</overWriteReleases>
88+
<overWriteSnapshots>false</overWriteSnapshots>
89+
<overWriteIfNewer>true</overWriteIfNewer>
90+
</configuration>
91+
</execution>
92+
</executions>
93+
</plugin>
94+
95+
<plugin>
96+
<groupId>org.apache.maven.plugins</groupId>
97+
<artifactId>maven-jar-plugin</artifactId>
98+
<version>3.3.0</version>
99+
<configuration>
100+
<archive>
101+
<manifest>
102+
<addClasspath>true</addClasspath>
103+
<classpathPrefix>libs</classpathPrefix>
104+
<mainClass>${mainClass}</mainClass>
105+
</manifest>
106+
<manifestEntries>
107+
<Class-Path>libs/</Class-Path>
108+
</manifestEntries>
109+
</archive>
110+
</configuration>
111+
</plugin>
112+
113+
<!--fat jar-->
114+
<plugin>
115+
<groupId>org.apache.maven.plugins</groupId>
116+
<artifactId>maven-assembly-plugin</artifactId>
117+
<version>3.4.2</version>
118+
119+
<configuration>
120+
<descriptorRefs>
121+
<descriptorRef>jar-with-dependencies</descriptorRef>
122+
</descriptorRefs>
123+
<archive>
124+
<manifest>
125+
<addClasspath>true</addClasspath>
126+
<mainClass>${mainClass}</mainClass>
127+
</manifest>
128+
</archive>
129+
</configuration>
130+
131+
<executions>
132+
<execution>
133+
<id>make-assembly</id>
134+
<phase>package</phase>
135+
<goals>
136+
<goal>single</goal>
137+
</goals>
138+
</execution>
139+
</executions>
140+
141+
</plugin>
142+
143+
<plugin>
144+
<groupId>org.codehaus.mojo</groupId>
145+
<artifactId>exec-maven-plugin</artifactId>
146+
<version>3.0.0</version>
147+
<executions>
148+
<execution>
149+
<id>java-agent</id>
150+
<goals>
151+
<goal>exec</goal>
152+
</goals>
153+
<configuration>
154+
<executable>java</executable>
155+
<workingDirectory>${project.build.directory}</workingDirectory>
156+
<arguments>
157+
<argument>-classpath</argument>
158+
<classpath/>
159+
<argument>${mainClass}</argument>
160+
</arguments>
161+
</configuration>
162+
</execution>
163+
<execution>
164+
<id>native</id>
165+
<goals>
166+
<goal>exec</goal>
167+
</goals>
168+
<configuration>
169+
<executable>${project.build.directory}/${nativeImageName}</executable>
170+
<workingDirectory>${project.build.directory}</workingDirectory>
171+
</configuration>
172+
</execution>
173+
</executions>
174+
</plugin>
175+
176+
177+
</plugins>
178+
179+
</build>
180+
181+
<profiles>
182+
<profile>
183+
<id>native</id>
184+
<build>
185+
<plugins>
186+
<plugin>
187+
<groupId>org.graalvm.buildtools</groupId>
188+
<artifactId>native-maven-plugin</artifactId>
189+
<version>${native.maven.plugin.version}</version>
190+
<extensions>true</extensions>
191+
<executions>
192+
<execution>
193+
<id>build-native</id>
194+
<goals>
195+
<goal>compile-no-fork</goal>
196+
</goals>
197+
<phase>package</phase>
198+
</execution>
199+
<execution>
200+
<id>test-native</id>
201+
<goals>
202+
<goal>test</goal>
203+
</goals>
204+
<phase>test</phase>
205+
</execution>
206+
</executions>
207+
<configuration>
208+
<fallback>false</fallback>
209+
<imageName>${nativeImageName}</imageName>
210+
<buildArgs>
211+
<arg>-H:DashboardDump=${project.build.directory}/jpaEntityManager -H:+DashboardAll -H:IncludeResources=test.xml -H:IncludeResources=META-INF/persistence.xml -H:IncludeResourceBundles=org.eclipse.persistence.exceptions.i18n.PersistenceUnitLoadingExceptionResource -H:IncludeResourceBundles=org.eclipse.persistence.exceptions.i18n.ValidationExceptionResource</arg>
212+
</buildArgs>
213+
<agent>
214+
<enabled>true</enabled>
215+
<options>
216+
<option>experimental-class-loader-support</option>
217+
</options>
218+
<!-- <options name="main"> <!- - main options - ->
219+
<option>access-filter-file=${basedir}/src/main/resources/access-filter.json</option>
220+
</options>
221+
<options name="test"> <!- - test options - ->
222+
<option>access-filter-file=${basedir}/src/test/resources/access-filter.json</option>
223+
</options> -->
224+
<options name="periodic-config"> <!-- periodic-config options -->
225+
<option>config-write-period-secs=1</option>
226+
<option>config-write-initial-delay-secs=1</option>
227+
</options>
228+
</agent>
229+
</configuration>
230+
</plugin>
231+
</plugins>
232+
</build>
233+
</profile>
234+
</profiles>
235+
236+
</project>

0 commit comments

Comments
 (0)