Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work with springboot project #63

Open
noxymon opened this issue Sep 3, 2020 · 9 comments
Open

Doesn't work with springboot project #63

noxymon opened this issue Sep 3, 2020 · 9 comments

Comments

@noxymon
Copy link

noxymon commented Sep 3, 2020

i tried this maven plugin using spring pet client project here :

https://github.com/spring-projects/spring-petclinic

using this config :

<plugin>
   <groupId>com.iluwatar.urm</groupId>
   <artifactId>urm-maven-plugin</artifactId>
   <version>2.0.0</version>
   <configuration>
      <packages>
         <param>org.springframework.samples.petclinic.owner</param>
      </packages>
      <includeMainDirectory>true</includeMainDirectory>
   </configuration>
   <executions>
      <execution>
         <phase>process-classes</phase>
         <goals>
            <goal>map</goal>
         </goals>
      </execution>
   </executions>
</plugin>

uml output is only

@startuml
@enduml

run it with java 11 openjdk. is there any missing config of mine ?

@ethutch
Copy link

ethutch commented Oct 20, 2020

Same problem here. Using both the maven plugin and the CLI it just doesn't produce anything at all.

@swetha-mamidi
Copy link

doesn't seem to work with spring-boot project. Tried both maven plugin and cli

@steven-ponessa
Copy link

Sam here. Just tried the CLI and only received:

@startuml
@enduml

Was going to try the maven plugin but then found this issue.

@crossworth
Copy link

OK, I know why this happens.

Springboot uses spring-boot-maven-plugin that does some repackaging, changing the default folder structure of the jar (puting the "generated jar" inside a BOOT-INF/classes/ folder).

We can "fix it" with two (or more) ways, the first is very simple, on the target folder there is a .original file, we could use it.

Another solution is using another plugin to generate the -jar-with-dependencies.jar version and use it:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
            <configuration>
                <finalName>${project.name}-${project.version}</finalName>
                <archive>
                    <manifest>
                        <mainClass>
                            ${main.class}
                        </mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </configuration>
        </execution>
    </executions>
</plugin>

@21r8390
Copy link

21r8390 commented Jun 10, 2022

I have the same problem with a SpringBoot project! Im using Java 18 and SpringBoot version 2.7.0.

The plugin only generates:

@startuml
@enduml

or:

digraph domain {
  edge [ fontsize = 11 ];
  node [ shape=record ];
}

@crossworth When I use the CLI, either with .original or -jar-with-dependencies.jar, I get the error:

java.lang.ClassNotFoundException: com.iluwatar.urm.DomainMapperCli

For running I use the following command:

java -cp SNS-1.5.2-jar-with-dependencies.jar:urm-core-2.0.0.jar com.iluwatar.urm.DomainMapperCli -p ch.bztf.m226blb1.Database.Entities

Is there any way to run the plugin in Maven directly / configure that the .original should be used??? @iluwatar

@kravitej9
Copy link

Same issue facing @iluwatar
Can you please help us

@klingen-m
Copy link

@kravitej9 @21r8390 you are missing the urm-core-2.0.0.jar in the classpath
try this:
java -cp .\xyz-0.0.1-jar-with-dependencies.jar -cp .\urm-core-2.0.0.jar com.iluwatar.urm.DomainMapperCli -p my.package

anyway it still doesn't create diagrams from spring projects no matter if jar-with-dependency .original or .war @iluwatar

@klingen-m
Copy link

klingen-m commented Jul 4, 2022

Hey @iluwatar,
I implemented a solution, by creating my own classloader and add the files from within the jar manually at runtime and hand this classloader to the exisiting methods. Works like a charm...don't mind if you give me push access so i can upload the branch

in the mean time => https://github.com/klingen-m/uml-reverse-mapper/tree/feature/add-war-support

@iluwatar
Copy link
Owner

@klingen-m feel free to submit pull request, no write access needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

9 participants