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

No instructions to use this project from Maven? #64

Closed
aborroy opened this issue Oct 17, 2019 · 10 comments
Closed

No instructions to use this project from Maven? #64

aborroy opened this issue Oct 17, 2019 · 10 comments

Comments

@aborroy
Copy link

aborroy commented Oct 17, 2019

It looks too complex to use this project from Maven, since it's required to download two different source projects, build them and add them to local Maven repository.

Almost useless when working with Maven.

@nomemory
Copy link
Owner

https://www.mockneat.com/start/

You can find the instructions to include it in a maven build.

@aborroy
Copy link
Author

aborroy commented Oct 18, 2019

Did you try these instructions recently? I think the artifact is not available in that repository... This is why I had to build everything by my own.

@nomemory
Copy link
Owner

Just tested by creating a new maven project. My pom file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>net.andreinc.mockneattest</groupId>
    <artifactId>mockneattest</artifactId>
    <version>1.0-SNAPSHOT</version>

    <repositories>
        <repository>
            <id>jcenter</id>
            <url>https://jcenter.bintray.com/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>net.andreinc.mockneat</groupId>
            <artifactId>mockneat</artifactId>
            <version>0.3.7</version>
        </dependency>
    </dependencies>

</project>

It works for me.
Are you sure you don't have some networking issues that won't allow you to download the artifact.

@nomemory
Copy link
Owner

PS: Refrain from using terms like "useless". It's not nice.

@aborroy
Copy link
Author

aborroy commented Oct 18, 2019

You are right, it was not elegant to use that "useless". This is a great work and I was frustrated not to be able to use it.

The problem with that is the dependency seems not to be working, as I'm getting following error:

java.lang.NoClassDefFoundError: net/andreinc/mockneat/unit/address/Countries
	at net.andreinc.mockneat.MockNeat.<init>(MockNeat.java:111)
	at net.andreinc.mockneat.MockNeat.<clinit>(MockNeat.java:55)
	at net.andreinc.mockneat.unit.text.Markovs.markovs(Markovs.java:52)
	at org.alfresco.cmis.load.App.run(App.java:34)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:818)
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:802)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:341)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265)
	at org.alfresco.cmis.load.App.main(App.java:22)
Caused by: java.lang.ClassNotFoundException: net.andreinc.mockneat.unit.address.Countries
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 10 common frames omitted

Are there any other dependencies missing?

@nomemory
Copy link
Owner

This is indeed very awkward...

  1. I've created a new maven project from scratch (with the pom file attached).
  2. I've used the countries() method and it worked.

Maybe the library was not compiled successfully...

What I suggest:

  1. Remove the local maven dependency (maybe the sources were not compiled correctly).
  2. Create a project from scratch and that uses a similar pom config as the one I've attached.
  3. Try to run the mockneat project from there.
  4. Try to do it in an internet network that is "open".

In jcenter() - the repo were the library was made public I can see everyday a lot of download logs, and I am 100% people are using it from maven all the time, from all over the world, without issues. So I believe it's a problem in your local setup...

Another thing I can try help you -> if it's possible share the sources of the project where you are currently using mockneat (if it's possible, of course) and I can try to make them run on my machine.

@aborroy
Copy link
Author

aborroy commented Oct 18, 2019

Thanks for you help, really appreciated.

It looks like there is some problem when using the library inside a Spring Boot application.

	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>2.0.5.RELEASE</version>
		<relativePath/>
	</parent>

When removing this dependency, the code runs fine.

Let me study this deeper and I'll come back with my findings.

@nomemory
Copy link
Owner

nomemory commented Oct 18, 2019

https://github.com/DeloitteDigitalRO/DDWatch

In this project you can see a spring boot application that uses mockneat. And it's using maven.

Tell me how it went I am curious to understand what was the issue.

@aborroy
Copy link
Author

aborroy commented Oct 18, 2019

Definitively it was my fault. Now it's working fine.

It looks like my ".m2" folder was corrupted. I've removed it completely and now mockneat dependency has been dowloaded correctly.

Sorry for taking your time.

@nomemory
Copy link
Owner

No problem! Good luck.

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

No branches or pull requests

2 participants