I have a java project in eclipse and I'm using ivy dependency manager outside of eclipse, so I have directory structures full of various jar files. Is there a simple way to point my eclipse project's path to the ivy dirs and pick up all the jars?
I'm trying to avoid pulling out each individual jar into my eclipse project directory and hope there's a better way.
There is an ivy plugin for eclipse:
http://ant.apache.org/ivy/ivyde/
A whackier idea is to use groovy to generate the Eclipse .project and .classpath files:
Using Apache Ivy with netbeans
Related
I am creating an Eclipse plugin for creating a perspective and I need to include a Typescript support for the perspective.
For this, I decided to use the open source project on Github for typescript.java given in this link.
I have packaged the maven project and got the jars and I have placed the jars in the folder called lib in my Eclipse Plug-in project and added the same jars in the classpath of the plugin but still, my project is not detecting the jars and not providing me with the support for Typescript.
I cannot add the Typescript jars to the dependencies section because it is not installed in eclipse so it is not detecting the plug-ins.
This is how my project structure looks like:
Project Structure
This is my build.properties file.
Please help me with this problem.
My problem is with a project where I use the POI library. It's from apache and allows you to work with excel,word, ... .
I had to add some jar files to my library and it runs perfect.
The problem is when I put my JAR file somewhere else.
It gives me the errors it can't find the librarys.
Is there a way I can put my librarys into the 1 jar?
I already tried to add my lib folder as source package but that didn't help.
there is a Maven plugin for Eclipse called M2Eclipse, which will read a POM and construct a classpath out of jars it finds in the local repository and any remote repositories you've configured. It behaves largely like Maven does in terms of finding the latest version for a given jar (if you've specified a version range in your POM).
You can also have a look on this
http://fredpuls.com/site/softwaredevelopment/java/deploy/five_strategies_for_managing_j.htm
You want to make a 'shaded' or 'uber' jar, which has all of its dependencies included
There is a maven plugin for building a shaded jar.
https://maven.apache.org/plugins/maven-shade-plugin/
For me the fastest/ easiest solution was to just open my project in eclips and export is a runable JAR then it adds the librarys to the JAR.
NetBeans builds your application into the project's dist folder. There is also a readme file in it, that tells you, you should distribute the contents of that folder...
Edit
Remove the lib folder, that is shown on the second image, from your sources.
I want to convert a Java/Dynamic web project to a Maven project. I use Eclipse IDE to develop Java applications.
One of the straight forward options available to me is to use 'Convert to Maven project' in Eclipse. But there are situations where I cannot use that option since the Maven plugin doesn't work in some networks like my Work environment.
So I want to know a Maven command (on Command Line) that would help me convert my Eclipse-built Java Web App to a Maven project.
Thank you in advance, Happy learning.
The Eclipse feature "Convert to Maven Project" works on projects that already have an appropriate POM. A project that was initially created by Eclipse doesn't have that POM.
So what you must do, is simply create a POM with packaging type WAR, then put it into the root of the project.
You also have to take care of the source directories. The Maven standard way is to have all sources under these four directories:
src/main/java
src/main/resources
src/test/java
src/test/resources
Eclipse simply stores everything under src. So you either change your file and directory structure, or you change the appropriate <build> parameters in the POM. I suggest the former.
The "Convert to Maven Project" feature does more than adding the Maven nature to the Eclipse build settings. It also creates and configures the Eclipse project meta files (the files .project and .classpath and the folder .settings). Therefore I suggest to delete them first in your project directory, so Eclipse can start on a clean project.
Afterwards you simply can convert your project with the above mentioned feature. It should create the meta files, and - as it is a web project (packaging type WAR) - it also should add the appropriate natures that let Eclipse show the project as a web project.
My project refers to the generated pom.properties file that Maven generates in:
META-INF/maven/${groupId}/${artifactId}
Which is included (in a Jar) as a dependency in another project. When I build / package the main project with Maven outside of Eclipse, the dependency Jar is built as expected (containing the pom.properties file) and all is well.
However, when I build / run the same (parent) project within Eclipse, it's not there. What am I missing?
Using Eclipse, a Jar library of the dependency is there (in the lib folder), containing everything except the Maven generated files. So in my case:
META-INF/
META-INF/persistence.xml
META-INF/MANIFEST.MF
~~~ snip ~~~
The dependency project exists in the same workspace and I have "Workspace Resolution" enabled.
Looking at the build target folder in Eclipse (\target\classes), I can see all the files that Eclipse uses for the Jar, so I can only assume that Eclipse treats it as a "regular" Java project (despite the parent project listing it as a Maven dependency in the POM) - so Maven doesn't get involved in the packaging.
How can I get Eclipse to treat the project dependency as a Maven project / so that the generated pom.properties will be included in the Jar used by the parent project?
Update
For the parent (War) project, the following structure is generated whenever I use Eclipse to build the project (using "Build Project" or "Build Automatically" not "Maven build"):
target\m2e-wtp\web-resources\META-INF\maven\${groupId}\${artifactId}\pom.properties
This is referenced in the Eclipse deployment assembly:
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
So that when the War is deployed to Tomcat, the META-INF\maven... structure exists at the root of the archive.
The dependency / Jar project obviously has the same "Deployment Assembly" facility in Eclipse, so I just need to figure out what creates the m2e-wtp folder on build and apply it to that project too.
Actually, I don't think you can with the default Eclipse Jar-Export.
The best you can do if you want to do it from within Eclipse is to have a Maven Build run configuration which doesn't do much differently than using Maven outside Eclipse. But at least you have a button in Eclipse to click do generate the jar, if that's the main reason. But the normal Eclipse functionality to produce a jar (File > Export...) ignores all Maven settings.
Workspace Resolution only works for compiling and running code, but not for other Maven functionality.
I am new to Ant. I have an existing Ant project and imported into Eclipse without any issues.
My actual project structure is as below outside eclipse:
But after importing into eclipse, I can see only src folder and build.xml and referenced libraries folder. I could not see other folders inside eclipse. It is web application and EAR file is created.
Do i need to convert the project as eclipse project to see all the folders? Like eclipse:eclipse for maven projects is there any command for Ant projects? Please help me.
Thanks!