Can't include LWJGL using Maven in Visual Studio Code - java

I'm trying to build my project with LWJGL library included, using Maven and VSC, but I can't understand how is it working.
I was looking into http://wiki.lwjgl.org/wiki/Setting_Up_LWJGL_with_Maven.html, but console is saying me, that it doesn't know what methods, which I am using, are...
I'm trying to build example from https://www.lwjgl.org/guide. There is repo for ant build sistem, but it is necessary for me to use Maven. Please, help me to adapt it.
UPD
After I copypasted pom.xml from link given in post, I got following errors:
> Executing task: mvn -B verify <
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for myProject:myGame:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 62, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] --------------------------< myProject:myGame >--------------------------
[INFO] Building myGame 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Downloading from slick: http://slick.cokeandcode.com/mavenrepo/slick/slick/274/slick-274.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.873 s
[INFO] Finished at: 2018-09-09T03:13:22+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project myGame: Could not resolve dependencies for project myProject:myGame:jar:1.0-SNAPSHOT: Failed to collect dependencies at slick:slick:jar:274: Failed to read artifact descriptor for slick:slick:jar:274: Could not transfer artifact slick:slick:pom:274 from/to slick (http://slick.cokeandcode.com/mavenrepo): slick.cokeandcode.com: Unknown host slick.cokeandcode.com -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
And after I removed every ssection. which was containing 'Slick' (Since it isn't used in test example from lwjgl.org/guide), Maven built project successfully. But I still can't run project. I type java *myclass* and I get
> Exception in thread "main" java.lang.Error: Unresolved compilation
> problems:
> Version cannot be resolved
> The method glfwFreeCallbacks(long) is undefined for the type Main
> The method glfwDestroyWindow(long) is undefined for the type Main
> The method glfwTerminate() is undefined for the type Main
> The method glfwSetErrorCallback(null) is undefined for the type Main
>
> at game.Main.run(Main.java:36)
> at game.Main.main(Main.java:128)

Related

Why does Maven randomly stop seeing dependencies and how do I make it?

I have a Maven project using Jetty as a runner – in case it's relevant. My pom.xml file contains the following
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>7.17.3</version>
</dependency>
It used to be 7.14.2 and I upgraded it. After cleaning and refreshing, IntelliJ says some of the classes in one of the packages on which transport depends can't be found anymore. I tried forcing refreshes, cleaned the project multiple times, resolving dependencies... nothing, the project doesn't even build anymore because of those missing classes. I figured I'd downgrade it again, just in case I missed a breaking change somewhere but now I have the older version and the classes are still not there. I switched to a branch which I'm sure works and sure enough everything builds and runs just fine.
I checked with mvn dependency:tree and this is what comes up:
[INFO] +- org.elasticsearch.client:transport:jar:7.17.3:compile
[INFO] | +- org.elasticsearch:elasticsearch:jar:7.17.3:compile
[INFO] | | +- org.elasticsearch:elasticsearch-core:jar:7.17.3:compile
[INFO] | | +- org.elasticsearch:elasticsearch-secure-sm:jar:7.17.3:compile
[INFO] | | +- org.elasticsearch:elasticsearch-x-content:jar:7.17.3:compile
elasticsearch-x-content is the package that is supposed to contain those classes and it shows up correctly (in the downgraded version too) but the classes are nowhere to be found.
I have had similar problems in the past where either Maven or IntelliJ IDEA randomly decide to stop seeing things that they were both happy to see just 20 minutes prior, and I never know how I manage to "fix" the issue each time so I don't have a repeatable series of incantations that I can offer as a clue.
Any ideas?
EDIT: I just tried a mvn dependency:purge-local-repository and no joy. I tried refreshing Maven from inside IntelliJ IDEA, nothing. I tried mvn compile and mvn package -U and nope.
EDIT 2: This is the error I'm getting on mvn compile:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/morpheu5/src/isaac/isaac-api/src/main/java/uk/ac/cam/cl/dtg/segue/etl/ElasticSearchIndexer.java:[20,40] error: cannot find symbol
[ERROR] package org.elasticsearch.common.xcontent
/Users/morpheu5/src/isaac/isaac-api/src/main/java/uk/ac/cam/cl/dtg/segue/etl/ElasticSearchIndexer.java:[21,40] error: cannot find symbol
[ERROR] package org.elasticsearch.common.xcontent
/Users/morpheu5/src/isaac/isaac-api/src/main/java/uk/ac/cam/cl/dtg/segue/etl/ElasticSearchIndexer.java:[22,40] error: cannot find symbol
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.623 s
[INFO] Finished at: 2022-04-26T13:56:15+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project isaac-api: Compilation failure: Compilation failure:
[ERROR] /Users/morpheu5/src/isaac/isaac-api/src/main/java/uk/ac/cam/cl/dtg/segue/etl/ElasticSearchIndexer.java:[20,40] error: cannot find symbol
[ERROR] package org.elasticsearch.common.xcontent
[ERROR] /Users/morpheu5/src/isaac/isaac-api/src/main/java/uk/ac/cam/cl/dtg/segue/etl/ElasticSearchIndexer.java:[21,40] error: cannot find symbol
[ERROR] package org.elasticsearch.common.xcontent
[ERROR] /Users/morpheu5/src/isaac/isaac-api/src/main/java/uk/ac/cam/cl/dtg/segue/etl/ElasticSearchIndexer.java:[22,40] error: cannot find symbol
Did you try running mvn compile from the command line and then refresing the project? Sometimes Intellij will bug out and not actually download a dependency even though it says it's trying to (happened to me a week ago).

Jenkins build failed: package org.eclipse.swt does not exist

I am trying to build a RCP product in Jenkins with configuration: maven: 3.0.5 and Java 1.7. It is building locally but failing with the following error in Jenkins.
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
[INFO] [1m------------------------------------------------------------------------[m
[INFO] [1;31mBUILD FAILURE[m
[INFO] [1m------------------------------------------------------------------------[m
[INFO] Total time: 7.360 s
[INFO] Finished at: 2019-10-24T13:55:12-05:00
[INFO] [1m------------------------------------------------------------------------[m
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project myrcp-app: Compilation failure: Compilation failure:
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[8,23] package org.eclipse.swt does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[9,30] package org.eclipse.swt.events does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[10,30] package org.eclipse.swt.events does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[11,32] package org.eclipse.swt.graphics does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[12,30] package org.eclipse.swt.layout does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[13,30] package org.eclipse.swt.layout does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/com/company/myrcp/app/internal/handlers/AboutHandler.java:[14,30] package org.eclipse.swt.layout does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[15,31] package org.eclipse.swt.widgets does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[16,31] package org.eclipse.swt.widgets does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[17,31] package org.eclipse.swt.widgets does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[18,31] package org.eclipse.swt.widgets does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[19,31] package org.eclipse.swt.widgets does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[20,31] package org.eclipse.swt.widgets does not exist
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/internal/handlers/AboutHandler.java:[45,39] cannot find symbol
[ERROR] symbol: class Dialog
[ERROR] location: class com.company.myrcp.app.internal.handlers.AboutHandler
[ERROR] /c:/jenkins/workspace/myrcp-app/src/main/java/com/company/myrcp/app/nternal/handlers/AboutHandler.java:[47,34] cannot find symbol
[ERROR] symbol: class Shell
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
The following dependency is also present in POM:
<dependency>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt</artifactId>
<scope>compile</scope>
</dependency>
Not sure if I have to add any plugins to make it run in Jenkins?
If you are using maven you specify the version. Once you successfully built-in local version you can investigate is all the dependency is available. If you try to run in eclipse internally eclipse understand the dependency and help your build in local.
Fortunately, if you are running Jenkins in another machine to build the code from repo you have to specify the version and maven downloads the dependency and get it build.
It can be eliminated by maintaining the remote repository internally. If you have an internal repo then consider checking the repo availability.

Maven compile fails silently - Unresolved compilation problems

I have an interesting problem with a spring webapp maven build. When being built inside eclipse everything is fine yet when built via maven and deployed to a tomcat 8 container the webapp fails on startup with the following error:
Caused by: java.lang.NoClassDefFoundError: FilterConfig
Now I tried all the obvious and well documented dependency issues (setting scope provided on the javax.servlet-api & jsp-api import and making sure they are of the latest versions as this is a Java 8 project). I have made sure all of the complier plugins are of the latest versions:
maven-war-plugin
3.1.0
maven-compiler-plugin
3.6.1
yet the webapp fails to start with no errors being shown in the maven build console output. After much head-scratching and painstaking comparison between the (working) eclipse build and the mysteriously failing maven equivalent it was discovered that inside some of the class files generated by maven were texts describing compilation problems. (The following was extracted from the "Open With > Text Editor" option in eclipse against the .class file - some of the characters had to be omitted as they wouldn't copy correctly)
Unresolved compilation problems:
The import javax.servlet.Filter cannot be resolved
The import javax.servlet.FilterChain cannot be resolved
The import javax.servlet.FilterConfig cannot be resolved
The import javax.servlet.ServletException cannot be resolved
The import javax.servlet.ServletRequest cannot be resolved
The import javax.servlet.ServletResponse cannot be resolved
The import javax.servlet.http.HttpServletRequest cannot be resolved
The import javax.servlet.http.HttpSession cannot be resolved
Filter cannot be resolved to a type
FilterConfig cannot be resolved to a type
ServletException cannot be resolved to a type
ServletRequest cannot be resolved to a type
ServletResponse cannot be resolved to a type
FilterChain cannot be resolved to a type
ServletException cannot be resolved to a type
HttpServletRequest cannot be resolved to a type
HttpServletRequest cannot be resolved to a type
HttpSession cannot be resolved to a type
I cannot understand how the maven process appears to complete successfully and that no errors are shown with any of the mvn goals I've tried
mvn complier:compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxx 2.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # EBPP ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) # EBPP ---
[INFO] Nothing to compile - all classes are up to date
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.413 s
[INFO] Finished at: 2017-06-28T15:11:45+01:00
[INFO] Final Memory: 9M/213M
[INFO] ------------------------------------------------------------------------
the above but with the -x showed a lot of debugging output but nothing to suggest compile problems, in fact it states that the class-file identified unresolved dependencies are included
...
[DEBUG] javax.servlet:javax.servlet-api:jar:3.1.0:provided
[DEBUG] org.apache.velocity:velocity:jar:1.7:compile
[DEBUG] commons-collections:commons-collections:jar:3.2.1:compile
[DEBUG] commons-lang:commons-lang:jar:2.4:compile
[DEBUG] javax.servlet.jsp:jsp-api:jar:2.2:provided
...
mvn dependency:build-classpath
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxx 2.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:build-classpath (default-cli) # EBPP ---
[INFO] Dependencies classpath:
C:\Users\xxxxxx\.m2\repository\org\springframework\webflow\spring-webflow\2.4.5.RELEASE\spring-webflow-2.4.5.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\commons-logging\commons-logging\1.2\commons-logging-1.2.jar;C:\Users\xxxxxx\.m2\repository\opensymphony\ognl\2.6.11\ognl-2.6.11.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\webflow\spring-binding\2.4.5.RELEASE\spring-binding-2.4.5.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\webflow\spring-js\2.4.5.RELEASE\spring-js-2.4.5.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\webflow\spring-js-resources\2.4.5.RELEASE\spring-js-resources-2.4.5.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\spring-beans\4.3.0.RELEASE\spring-beans-4.3.0.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\spring-context\4.3.0.RELEASE\spring-context-4.3.0.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\spring-aop\4.3.0.RELEASE\spring-aop-4.3.0.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\spring-expression\4.3.0.RELEASE\spring-expression-4.3.0.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\spring-web\4.3.0.RELEASE\spring-web-4.3.0.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\spring-webmvc\4.3.0.RELEASE\spring-webmvc-4.3.0.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\spring-core\4.3.9.RELEASE\spring-core-4.3.9.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\com\xxxxxxx\ebpp\JComms\2.0.1\JComms-2.0.1.jar;C:\Users\xxxxxx\.m2\repository\log4j\log4j\1.2.17\log4j-1.2.17.jar;C:\Users\xxxxxx\.m2\repository\javax\mail\mail\1.4.7\mail-1.4.7.jar;C:\Users\xxxxxx\.m2\repository\javax\activation\activation\1.1\activation-1.1.jar;C:\Users\xxxxxx\.m2\repository\org\apache\httpcomponents\httpclient\4.5.1\httpclient-4.5.1.jar;C:\Users\xxxxxx\.m2\repository\org\apache\httpcomponents\httpcore\4.4.3\httpcore-4.4.3.jar;C:\Users\xxxxxx\.m2\repository\commons-codec\commons-codec\1.9\commons-codec-1.9.jar;C:\Users\xxxxxx\.m2\repository\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;C:\Users\xxxxxx\.m2\repository\com\xxxxxxx\ebpp\JCore\2.0.1\JCore-2.0.1.jar;C:\Users\xxxxxx\.m2\repository\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;C:\Users\xxxxxx\.m2\repository\org\apache\velocity\velocity\1.7\velocity-1.7.jar;C:\Users\xxxxxx\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar;C:\Users\xxxxxx\.m2\repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar;C:\Users\xxxxxx\.m2\repository\javax\servlet\jsp\jsp-api\2.2\jsp-api-2.2.jar;C:\Users\xxxxxx\.m2\repository\junit\junit\3.8.2\junit-3.8.2.jar;C:\Users\xxxxxx\.m2\repository\org\springframework\spring-context-support\4.3.9.RELEASE\spring-context-support-4.3.9.RELEASE.jar;C:\Users\xxxxxx\.m2\repository\com\xxxxxxx\xxxxxxx\440\xxxxxxx-440.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.331 s
[INFO] Finished at: 2017-06-28T15:13:05+01:00
[INFO] Final Memory: 13M/213M
[INFO] ------------------------------------------------------------------------
mvn validate
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xxx 2.0.1
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.109 s
[INFO] Finished at: 2017-06-28T15:15:32+01:00
[INFO] Final Memory: 7M/213M
[INFO] ------------------------------------------------------------------------
I really am stumped. I'm presuming maven is using a different compiler from eclipse but I really have run out of ideas.
Has anyone else encountered this before?
Thanks in advance.
I suspect it's a combination of eclipse building your files with compilation errors (yes, Eclipse can do that: if you never reach the un-compilable code, then you don't even get errors) and Maven not cleaning the output of Eclipse first.
Then Maven sees that the file is up-to-date, and doesn't overwrite it.
I suggest the following (to check if I'm right):
Turn off Eclipse's automatic build (or stop eclipse altogether).
Run a Maven target, such as package but also run clean (i.e. mvn clean package); the point is to be 100% sure that Maven builds those files and not Eclipse.
Maven should now report compilation errors.
As for the error itself, it looks like you are indeed missing a dependency (but probably in Eclipse's classpath, not Maven's).
So when comparing this project to another successful project (that were both converted from Java 4), on the hunch that using non standard directory names was the cause for mavens erratic behavior (while copying the warSourceDirectory). I analysed the (now called) WebRoot > WEB-INF > classes directory and discovered that for the problematic app this had been populated, with you've guessed it - incorrectly compiled class files! Clearly the war plugin copied these bad files over the top of the files Maven had, in the same build process just successfully complied - hence no error.
I am unsure why the bad files were there as they were not in the old Java 4 project. I suspect that they must have been created somehow during a previous failed maven build using incorrect settings.

How does Maven work?

I need to send my Maven project(written in IDEA) to another guy. So I've got a question : which files exactly i should send. As i understand there are:
.idea folder , src folder and pom file. Afther this i just need to perform this command in directory with pom file on another computer:
mvn install
And i've got built project and jar file.Am i right?
If it is correct i've got a problem - i've got nothing in my local maven repository.
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # Pa
ragonCase ---
[WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # Paragon
Case ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # ParagonCase ---
[INFO] Surefire report directory: C:\Users\Kru\IdeaProjects\PopularWords\target\
surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running MainTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.118 sec
Results :
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # ParagonCase ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # ParagonCase ---
[INFO] Installing C:\Users\Kru\IdeaProjects\PopularWords\target\ParagonCase-1.2.
jar to C:\Users\Kru\.m2\repository\ru\nick\kru\ParagonCase\1.2\ParagonCase-1.2.j
ar
[WARNING] Failed to create parent directories for tracking file C:\Users\Kru\.m2
\repository\ru\nick\kru\ParagonCase\1.2\_remote.repositories
[INFO] Installing C:\Users\Kru\IdeaProjects\PopularWords\pom.xml to C:\Users\Kru
\.m2\repository\ru\nick\kru\ParagonCase\1.2\ParagonCase-1.2.pom
[WARNING] Failed to create parent directories for tracking file C:\Users\Kru\.m2
\repository\ru\nick\kru\ParagonCase\1.2\_remote.repositories
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.874 s
[INFO] Finished at: 2016-03-31T20:25:37+03:00
[INFO] Final Memory: 10M/155M
[INFO] ------------------------------------------------------------------------
I need to send my Maven project(written in IDEA) to another guy. So I've got a question : which files exactly i should send.
The only things you need to send are pom.xml and the foldersrc. And you don't have to send the .idea folder because it is IDEA specific and nothing to do with Maven; so the receiver can choose his own favorite IDE.
And i've got built project and jar file.Am i right?
Yes, you're right.
If it is correct i've got a problem - i've got nothing in my local maven repository.
The project seems to have built correctly as you can see from the following log output:
[INFO] Installing C:\Users\Kru\IdeaProjects\PopularWords\target\ParagonCase-1.2.jar to C:\Users\Kru.m2\repository\ru\nick\kru\ParagonCase\1.2\ParagonCase-1.2.jar
To verify this you can go to the targetdirectory and see if the jar file is there.
Why you're not getting the artifacts in the local repository may have to do with the warning displayed where Maven is complaining that it cannot create parent directories:
[WARNING] Failed to create parent directories for tracking file C:\Users\Kru.m2\repository\ru\nick\kru\ParagonCase\1.2_remote.repositories
[INFO] Installing C:\Users\Kru\IdeaProjects\PopularWords\pom.xml to C:\Users\Kru.m2\repository\ru\nick\kru\ParagonCase\1.2\ParagonCase-1.2.pom
[WARNING] Failed to create parent directories for tracking file C:\Users\Kru.m2\repository\ru\nick\kru\ParagonCase\1.2_remote.repositories
So I would suggest that you investigate why Maven cannot create thos directories.
You should have something in your local .m2, but there's no need for you to send that to your partner. Maven will go out to the central repo if it doesn't find a JAR in the .m2.
If you're saying you have JARs that are private to your app that aren't available in any central Maven repo then you do have a problem. Anyone using your app will have to satisfy the dependencies when they build.
If you cannot put your app into GitHub and have others successfully build it by checking out, then you're doing it wrong.

jaxb episodic compilation with maven

I am trying to execute the maven-jaxb2-plugin-sample-episode-0.7.4 (explained here and with a download available) to try separate schema compilation. Despite it compiles the first schema (A), it fails in the second one (B) because it is not able to resolve the artifact maven-jaxb2-plugin-sample-episode-a-maven:jar:0.7.4.
I execute mvn assembly:assembly from the command line (windows) and this is the error I get:
...
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven JAXB 2.x Plugin Sample [episode-b|maven]
[INFO] ------------------------------------------------------------------------
[INFO] [jaxb2:generate {execution: default}]
Downloading: http://repo1.maven.org/maven2/org/jvnet/jaxb2/maven2/maven-jaxb2-pl
ugin-sample-episode-a-maven/0.7.4/maven-jaxb2-plugin-sample-episode-a-maven-0.7.
4.jar
[INFO] Unable to find resource 'org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-sample
-episode-a-maven:jar:0.7.4' in repository central (http://repo1.maven.org/maven2
)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Could not resolve the artifact.
Embedded error: Missing:
----------
1) org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-sample-episode-a-maven:jar:0.7.4
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.jvnet.jaxb2.maven2 -DartifactId=mav
en-jaxb2-plugin-sample-episode-a-maven -Dversion=0.7.4 -Dpackaging=jar -Dfile=/p
ath/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.jvnet.jaxb2.maven2 -DartifactId=maven
-jaxb2-plugin-sample-episode-a-maven -Dversion=0.7.4 -Dpackaging=jar -Dfile=/pat
h/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-ample-episode-b-maven:jar:0
.7.4
2) org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-sample-episode-a-maven:jar:
0.7.4
----------
1 required artifact is missing.
for artifact:
org.jvnet.jaxb2.maven2:maven-jaxb2-plugin-ample-episode-b-maven:jar:0.7.4
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8 seconds
[INFO] Finished at: Wed Dec 22 16:31:29 CET 2010
[INFO] Final Memory: 16M/39M
[INFO] ------------------------------------------------------------------------
The example should work as it is so, what am I doing wrong ? In the real scenario I have more than 10 schemas that have to be compiled as different episodes, so I need the proccess to be automatic (i.e no need to execute "mvn something" for each individual artifact)
The module maven-jaxb2-plugin-ample-episode-b-maven depends on maven-jaxb2-plugin-ample-episode-a-maven.
When mvn assembly:assembly is run from the parent folder (which contains the two modules), it builds the jar for maven-jaxb2-plugin-ample-episode-a-maven, but does not install it in your local repository.
When it then tries to build maven-jaxb2-plugin-ample-episode-b-maven, it looks for the dependency (maven-jaxb2-plugin-ample-episode-a-maven) and fails to find it in the local repository. Thus the error.
The question is, why would you want to run mvn assembly:assembly, which is used to create a binary distribution? There are no assembly descriptors in either module.
mvn install works fine and build both the modules successfully.

Categories

Resources