SAP / olingo-jpa-processor-v4

The JPA Processor fills the gap between Olingo V4 and the database, by providing a mapping between JPA metadata and OData metadata, generating queries and supporting the entity manipulations.
Apache License 2.0
128 stars 79 forks source link

Maven update-local-catalogue works but not creating file archetype-catalog.xml #162

Open Boltzmann opened 2 years ago

Boltzmann commented 2 years ago

I use Intellij for development. Following the quick start guide I get no warning or error right clicking the pom.xml of odata-jpa-archetype-spring or following the guides command line ansatz. However, I do not get a archetype-catalog.xml whether with WSL2 on Windows 11 or Ubuntu 22.04.1 LTS both in the terminal or using Intellij Community or Ultimate. E.g. in the Ubuntu 22 bash mvn --version gives

Java version: 17, vendor: Oracle Corporation, runtime: /home/username/.sdkman/candidates/java/17-open
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.15.0-43-generic", arch: "amd64", family: "unix"

The text in QuickStart.md states

Open a shell, like the Windows console, navigate to the directory the repository had been cloned to and then to odata-jpa-archetype-spring. Starting from the home directory this could be e.g. cd git\olingo-jpa-processor-v4\jpa-archetype\odata-jpa-archetype-spring. We do that to generate the archetype. This is done by execute mvn clean install archetype:update-local-catalog. Alternatively you can also use your IDE: ... In your .m2 directory there should be a file called archetype-catalog.xml:

Without this I cannot choose the jpa archetype in the next step.

esajic-ct commented 2 years ago

I have a similar problem. I'm using Maven 3.3.9 and Java 1.8. This is what I've done so far:

This is the command I'm running:

mvn.cmd archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=com.sap.olingo -DarchetypeArtifactId=odata-jpa-archetype-spring -DarchetypeVersion=1.0.9-SNAPSHOT -DgroupId=com.example -DartifactId=trippin -Dpunit=Trippin -Dschema=Trippin -Dentity-table=Person -Dvalue-object-table=Trip -DinteractiveMode=false

Initially it says

Archetype repository not defined. Using the one from [com.sap.olingo:odata-jpa-archetype-spring:1.0.9-SNAPSHOT] found in catalog local

but then later attempts to download from the remote, and fails with this message:

Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate (default-cli) on project standalone-pom: The desired archetype does not exist (com.sap.olingo:odata-jpa-archetype-spring:1.0.9-SNAPSHOT)

So I am unable to use the Archetype to generate a project.

esajic-ct commented 2 years ago

I have now got a workaround for this issue - follow the instructions in my previous comment above and then you also need to perform the archetype install process on the olingo-jpa-processor-v4\jpa-archetype\ folder.

Here are the extra steps needed:

cd olingo-jpa-processor-v4\jpa-archetype\

# Install the jpa-archetype in your local m2 repo
# It appears this is a parent of the odata-jpa-archetype-spring archetype
# and needs to be present for odata-jpa-archetype-spring to work properly
mvn.cmd clean install archetype:update-local-catalog

# Regenerate the archetype-catalog.xml
mvn.cmd archetype:crawl

# Contents of (user home)\.m2\repository\archetype-catalog.xml
# don't change after regeneration.
# The only com.sap.olingo archetype is this one still:
    <archetype>
      <groupId>com.sap.olingo</groupId>
      <artifactId>odata-jpa-archetype-spring</artifactId>
      <version>1.0.9-SNAPSHOT</version>
      <description>${rootArtifactId}-parent</description>
    </archetype>

 cd ..\..\

# Maven archetype:generate command should now work successfully
# and create a project folder called trippin underneath the folder you're in 
# when you run the command.

 mvn.cmd archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=com.sap.olingo -DarchetypeArtifactId=odata-jpa-archetype-spring -DarchetypeVersion=1.0.9-SNAPSHOT -DgroupId=com.example -DartifactId=trippin -Dpunit=Trippin -Dschema=Trippin -Dentity-table=Person -Dvalue-object-table=Trip -DinteractiveMode=false
Boltzmann commented 2 years ago

I was able to follow above steps by @esajic-ct . However, in my environment I get the messages from post https://github.com/SAP/olingo-jpa-processor-v4/issues/162#issuecomment-1208334320. [...] Done the other steps of https://github.com/SAP/olingo-jpa-processor-v4/issues/162#issuecomment-1208361497 too, but am still getting above messages. So the workaround does not work here.

The workaround produces the desired folder structure trippin.

damian-fernandez-southern commented 1 year ago

I was running under the same issue too, and following @esajic-ct I was able to get further, but then I am getting the next error:

JDK: 17 Maven: 3.8.7

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.106 s [INFO] Finished at: 2023-02-02T16:44:15+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate (default-cli) on project hello: Unable to add module to the current project as it is not of packaging type 'pom' -> [Help 1]

spanky440 commented 1 year ago

Some related quick-start experiences: