Setting up maven folder m2 on windows 10 - eclipse

I just installed eclipse oxygen and I want to program using maven. I´m newbie with maven and I wonder if I need to set up something else, related with the m2 folder.
I would like to install Jersey, but I got the error :
Can't resolve Archetype
org.glassfish.jersey.archetypes:jersey-heroku-webapp:2.21
org.eclipse.core.runtime.CoreException: Could not resolve artifact
I already tried different options, this was my previous post jersey post
I´m looking for other alternatives, and in other posts I read about the folder m2, do I need to do something in there? if so, could you please provide a link with the steps.
Thank you!

The artifact org.glassfish.jersey.archetypes:jersey-heroku-webapp:2.21 is in MavenCentral. If you cannot get it you either:
use a settings.xml which does not allow you do access MavenCentral (by e.g. mirroring it). If you never wrote or copied a settings.xml this will not be the case.
or you have network problems. Your proxy or firewall might restrict the access to MavenCentral. This is especially likely if you are in a company network.

Related

Maven fixing broken dependencies

I just checked out maven based java project from svn to local box in eclipse where maven 3.0.2 is available. However while reviewing class path configuration many of dependencies are broken such as org.restlet-2.0.15.jar. Strange part is C:/Users/daeyoung/.m2/repository has that broken jar file but .lastUpdated is appended. After reading many posts from WWW, the way I understood to fix the problem is delete *.lastUpdated file then re-download it from central repo.
But when I reviewed pom.xml file there is no mention of repository (strange...) and as soon as I delete *.lastUpdated file, it comes back (e.g. org.restlet-2.0.15.jar.lastUpdated).
I am new to Maven.
I'd appreciate if someone can guide me to a right direction to fix this problem.
[update]
I created following user settings.xml file under /Users/daeyoung/.m2/ directory. I thought at least that would take care of downloading org.restlet package.
However when I ran mvn command (literally mvn) inside of project folder, system was saying..
I don't want to modify pom.xml file but rather via user settings.xml I thought I could connect to maven restlet repo and download specified target package but I am not sure what I am missing in here. I think contents of settings.xml is not correct.
I just want to say thanks to all who have given me advice. First I was not well equipped to understand the advice but more I looked at the problem/read about maven articles. It was clear what needs to be done to fix the problem.
Bottom line is I manually downloaded dependencies to ${user_name}/.m2/repository for missing jars. I configured ${MAVEN_HOME}/conf/settings.xml to point to local repository then I ran mvn validate/clean/package sequentially from eclipse via m2e plugin (or I could have done same thing from command line).

Remote Play framework and Eclipse

I have a play framework project which run on remote server.
I'm trying to configure eclipse to work remotely on the project.
since no build is required my requirements are to be able to edit the project files from eclipse and automatically save on server, auto complete and debug.
I've installed Remote System Explorer on eclipse and setup a remote ftp connection to my server.
The play environment on my server is under
/play-2.0.2/
My project path is
/play-2.0.2/test
In RSE I clicked on /play-2.0.2/test and 'Create Remote Project'
Now in Java perspective I can browse through the project, change files and then automatically save to server.
My problem is auto completion of play framework library doesn't work well since all the reference are to /play-2.0.2/repository/...
any idea how to solve it? I tried to play with the build path but no success
Thanks!
So, I was looking into achieving the same thing myself.
The problem you are experiencing is due to the fact that the .classpath file has absolute values. While for me, besides the symlink that doesn't work between two different kinds of O.S., I thought on another two solutions:
Use sed to rewrite the classpath on the .classpath file after it's generated
Use a "classpathTransformerFactory" for the sbt eclipse command
I haven't had to deal with it (it's more of want to than whatnot) as soon as I do, I will explore the two options and post details. I just leave the answer here in case someone wants to pick up where you left.
Another thing is:
Seen that sbt picks up the libs referenced in build.sbt, downloads the jars and puts them in the ~/.ivy2 directory, if you use any of those methods to change the reference from the remote machine to the local one, you would need to make sure that the same libs are on the local ivy cache. So, just as I wrote this, another idea came to mind:
sbt eclipse or play eclipse or activator eclipse [it should be the same] on a local environment, and on the remote one, then, transfer the .project and .classpath files from the local to the remote, and see what happens (if it doesn't work, scan them for absolute and incorrect paths that might need to be changed)
Sorry for the unproved answer, still I think it's better than no answer.
Cheers

Running an Eclipse plugin/update mirror

I'm trying to run a full Eclipse mirror for all the plugins / updates our development team might want or need. This is because our network is impeded by a WebSense proxy filter, which very often blocks plugins from downloading.
This has been exceptionally frustrating for all the devs concerned.
I finally got approval to run an Eclipse mirror on a dedicated server, which has unfettered access to the internet, and which all internal machines can access.
I've done a lot of reading up and learning about the Equinox P2 update mechanism, and about update site publishing.
I selected a test plugin to act as a touchstone, to see if it all works. It appears to, except for one thing:
The plugin itself has dependencies, which Eclipse then tries to get from the internet, and I cannot find anyway to override this so that it comes back to our own mirror instead.
How can I force Eclipse to always use our mirror, or how can I publish / chain dependencies so that Eclipse gets them from the mirror?
Thanks
I'm not sure 100% understanding your question.
I think you can add your mirror server as a repository when installing plug-ins from Eclipse's wizard. And disable all the built-in servers that have problem to be accessed in your Intranet.
If you don't modify it on GUI, you can modify the prefs files of p2.
<your eclipse>/p2/org.eclipse.equinox.p2.engine/.settings/org.eclipse.equinox.p2.artifact.repository.prefs
<your eclipse>/p2/org.eclipse.equinox.p2.engine/.settings/org.eclipse.equinox.p2.metadata.repository.prefs

Maven: Prevent upload of default-jar - only upload jar-with-dependencies

I'm evaluating Maven 3 at work. For several example projects I have to deploy them to a server (no repository), but that's not the problem.
In my current example-project I'm trying to upload only the "jar-with-dependencies".
and exactly that's my problem.
It all works fine, except that the main-artifact AND the jar-with-dependencies (created by the assembly-plugin) are uploaded.
How do I prevent Maven or rather the deploy-phase from uploading the main-jar and only upload a given or specified file (in this case, the assembly-file "jar-with-dependencies")?
Referring to the question Only create executable jar-with-dependencies in Maven, I can't just alter the packaging-setting to pom, because it will also prevent the assembly-plugin from adding my classes to the JAR file. It only creates a JAR file with the files of the dependencies.
I hope I'm clear about my problem, and you can help me ;)
if you just looking how to add a file to be deployed you can take a look here:
http://mojo.codehaus.org/build-helper-maven-plugin/attach-artifact-mojo.html
May be this helps. If not express your needs more in detail.
There seems to be no way to configure the deploy plugin to filter out some of the artifacts from a project and selectively deploy the others. Faced with a similar problem, we solved this with the ease-maven-plugin. It fit well into our release process but might not be the right choice for everyone as it mandates a two-step approach. During the build you would make a list of all artifacts and filter out those that you want deployed. In a second step, you then run mvn deploy on a separate project (or separate profile) in which the list of artifacts is attached to the project as the only artifacts which then get deployed. See the examples in the source code of the ease maven plugin to better understand how it works.
The original version is not able to filter out specific artifacts of a project. I have forked the project and added patches that add this.

Eclipse ignoring source when deploying webapp

I'm running eclipse with tomcat 5.5. For some unknown reason from one day to the other eclipse stoped compiling my beans and java files that are in the source folder.
If I go to the work directory, I find all the JSP compiled, the folders of the packadges i have, but no classes compiled inside of them. Neither eclipse, nor tomcat give errors. (Except when i try to access the non existing classes)
Anyone has any idea why this happens and how to fix it?
/fmsf
You might have "Build automatically" disabled. You can find it in the Project menu.
I've faced with such a scenario once. In addition it did not detect the local changes w.r.t the code repository. Honestly I don't know the reason but use of a new eclipse installation (Extraction) on same workspace resolved the issue.
Found the problem:
One of the files came out of SVN without read access. Eclipse blocked reading it and wouldn't compile.
+1 to all tks