How to add jar file to xtext plugin - eclipse

I need to add org.json jar to my xtext project.
I found many postings how to add jar to plugin but I dont understand how it works. Can someone provide a listing which steps (detailed) I have to do to achieve my goal?
Thanks in advance

there is no need to add a jar if you simply can install the plugin from eclipse orbit.
If you dont have a target platform
Help -> Install New Software
Add -> https://download.eclipse.org/tools/orbit/downloads/drops/R20190602212107/repository/
select JSON Implementation for Java (type org.json in the filter)
Next, Finish
restart
add org.json to required bundles
If you do have a .target file
add
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.json" version="1.0.0.v201011060100"/>
<repository location="https://download.eclipse.org/tools/orbit/downloads/drops/R20190602212107/repository"/>
</location>
if you really want to add a jar
create lib folder, paste jar
edit build.properties tick lib folder in Binary build
this should add lib/ to bin.includes
open Manifest, go to runtime tab
under classpath click add and select lib/xxxx.jar
if you want to export the package from the plugin add the package under exported package

Related

.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

I am new to Gwt i am trying to create a web application and invoke it using an maven plugin. But the problem is during invocation of code server i am getting an error like unable to find xxxx..gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source? I have tried to add the .gwt.xml file into class path in serveral ways like include additional classpath etc.., but nothing helps... is there is any way to add it to the maven class path.
It seems that the gwt-maven-plugin is not able to find the configured module.
Please see the configuration of this plugin in the pom.xml, i.e. the section:
<modules>
<!-- this refers to xxxx..gwt.xml -->
<module>xxxx</module>
</modules>
If you cant resolve the problem you could compare your project with a minimal working "Hello-World-GWT-Project".
You could create such a template-project with a maven archetype:
mvn archetype:generate -DarchetypeGroupId=org.codehaus.mojo -DarchetypeArtifactId=gwt-maven-plugin -DarchetypeVersion=2.7.0

How to build a feature to a zip file using Tycho

I'm trying to export an Eclipse feature using Tycho, replacing the "Export Wizard" found on the Eclipse overview of the feature. The wizard gives the option for the export destination as a zip file. Is there a way to do the same with Tycho?
In order to build a zip file with the feature and the feature's plug-ins, you need to add a module of the assembly packaging type eclipse-repository to your reactor:
Add an eclipse-repository module with the same parent POM as the
eclipse-feature module (in order to inherit the same target
platform configuration).
Create a category.xml file in the root of the new module with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature id="todo.your.feature.id" />
</site>
Add the new module to your root POM.

The import org.apache.commons cannot be resolved in eclipse juno

I am having a problem while compiling my project in Eclipse. It is showing the error The import org.apache.commons cannot be resolved.
Please tell me what does this error means and how to solve it.
The mentioned package/classes are not present in the compiletime classpath. Basically, Java has no idea what you're talking about when you say to import this and that. It can't find them in the classpath.
It's part of Apache Commons FileUpload. Just download the JAR and drop it in /WEB-INF/lib folder of the webapp project and this error should disappear. Don't forget to do the same for Apache Commons IO, that's where FileUpload depends on, otherwise you will get the same problem during runtime.
Unrelated to the concrete problem, I see that you're using Tomcat 7, which is a Servlet 3.0 compatible container. Do you know that you can just use the new request.getPart() method to obtain the uploaded file without the need for the whole Commons FileUpload stuff? Just add #MultipartConfig annotation to the servlet class so that you can use it. See also How to upload files to server using JSP/Servlet?
If you got a Apache Maven project, it's easy to use this package in your project. Just specify it in your pom.xml:
<project>
...
<properties>
<version.commons-io>2.4</version.commons-io>
</properties>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${version.commons-io}</version>
</dependency>
</dependencies>
...
</project>
expand "Java Resources" and then 'Libraries' (in eclipse project).
make sure that "Apache Tomcat" present.
if not follow-
right click on project -> "Build Path" -> "Java Build Path" -> "Add Library" -> select "Server Runtime" -> next -> select "Apache Tomcat -> click finish
You could just add one needed external jar file to the project.
Go to your project-->java build path-->libraries, add external JARS.Then add your downloaded file from the formal website. My default name is commons-codec-1.10.jar
Look for "poi-3.17.jar"!!!
Download from "https://poi.apache.org/download.html".
Click the one Binary Distribution -> poi-bin-3.17-20170915.tar.gz
Unzip the file download and look for this "poi-3.17.jar".
Problem solved and errors disappeared.
You could also add the external jar file to the project.
Go to your project-->properties-->java build path-->libraries, add external JARS. Then add your downloaded jar file.
In my little experience, I have solved the issue about org.apache.commons.cli, on my Eclipse Version: 2019-12 (4.14.0):
In Provar(2.8.0), Issue got resolved after adding the jar file(commons-io-2.11.0.jar) to the project.
Steps:
1.Download the latest JAR file from https://commons.apache.org/proper/commons-io/download_io.cgi
Added jar file under lib folder in project.
2.Project--> Properties --> Java build path --> Libraries--Add Jars from lib folder.

Beginner's Guide to Setup Xuggler

To work with Xuggler you need xuggle-xuggler-5.4.jar. According to the people who made this, most users only need the above-mentioned JAR file. However, this is what they say about using Xuggler without Maven or Ivy:
Using Xuggler WITHOUT Apache Maven or Apache Ivy
What are you... stuck
in 2003? Anyway, if you insist on this, Xuggler's pre-compiled
binaries (including native versions) can be found here. Make sure that
xuggle-xuggler.jar and its dependencies are included in your Java
classpath. See the xuggle-xugger-*.pom file distributed with the
version of Xuggler that you use to find the (small) set of dependent
jars, and download them as well.
I downloaded the xuggle-xuggler.jar file for the latest version, 5.4 but I don't understand the pom file for it.
What dependencies is he talking about?
Next, how do I download these dependencies ?
Once I get these dependencies, how do I start working in Eclipse?
Update After Downloading Dependencies
I have the following directory structure:
xuggle-xuggler-5.4.jar is stored in E:\xuggle
the various xuggler dependencies are stored in E:\xuggle\xuggle-dependencies
Question:
How do I start working with Xuggler in Eclipse? What paths do I have to set and what values do these paths have?
The following files list the other jars which xuggle depends upon:
ivy.xml
pom.xml
You can read these and then manually retrieve them from the appropriate repository, but I would submit it's simpler to start using a dependency manager.
You asked how to download these dependencies, well ivy has a convenient command-line mode of operation. (See example below)
Eclipse integration is very tough.... Once you've downloaded the jar you could try and generate the ".classpath" file or just manually add each jar via the Eclipse GUI.
The reason I don't recommend this approach is because there are Eclipse plugins for both Maven and Ivy that would do this for you automatically.
Example
Run ivy from command-line as follows:
java -jar ivy.jar -settings ivysettings.xml -dependency xuggle xuggle-xuggler 5.4 -retrieve "lib/[artifact]-[revision].[ext]"
It will retrieve xuggle and all its dependencies into a "lib" directory as follows:
├── ivysettings.xml
└── lib
├── commons-cli-1.1.jar
├── logback-classic-1.0.0.jar
├── logback-core-1.0.0.jar
├── slf4j-api-1.6.4.jar
└── xuggle-xuggler-5.4.jar
ivysettings.xml
This file tells ivy to retrieve jars from either Maven Central, or the Maven repository provided by the Xuggle project.
<ivysettings>
<settings defaultResolver="repos" />
<resolvers>
<chain name="repos">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="xuggle" m2compatible="true" root="http://xuggle.googlecode.com/svn/trunk/repo/share/java"/>
</chain>
</resolvers>
</ivysettings>
Don't fight Maven, embrace it. These days all major build systems are maven compatible (Maven, Ivy, Gradle, Grape, Buildr ...). But you can use Maven from Eclipse:
create a file called pom.xml with this content:
<project>
<groupId>com.foo<groupId> <!-- change these -->
<artifactId>foo</artifactId> <!-- parameters to whatever -->
<version>1.0-SNAPSHOT</version><!-- you like -->
<repositories>
<repository>
<id>xuggle repo</id>
<url>http://xuggle.googlecode.com/svn/trunk/repo/share/java/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>xuggle</groupId>
<artifactId>xuggle-xuggler</artifactId>
<version>5.2</version>
</dependency>
</dependencies>
</project>
Install the m2e extension and, from Eclipse, do "File > Import ... > Existing Maven Projects". In the dialog, select the Folder that contains the pom.xml.
Make sure that the Folder's layout is like this:
pom.xml
src/main/java // sources go here
src/test/java // test sources go here
Then you should have a working Eclipse project with the required dependencies.
Update after your update:
You can see the dependencies when you look at this file: http://xuggle.googlecode.com/svn/trunk/repo/share/java/xuggle/xuggle-xuggler/5.2/xuggle-xuggler-5.2.pom
commons-cli (a utility library for command line processing)
logback (a logging framework)
junit (a testingframework)
Maven will take care of loading these dependencies for you. So will Eclipse, if you use the m2e plugin as suggested above.
If you absolutely don't want to do that, you will have to download the dependencies manually. Look at the pom file above, note the names and versions of the dependencies, look them up at http://mvnrepository.com/ and download them there, e.g. this is the page for slf4j-api: http://mvnrepository.com/artifact/org.slf4j/slf4j-api/1.6.4

Eclipse Maven Dependency

I have just added dependencies to an eclipse project so that my jar can see other jars. How can I be sure that the dependencies work, and that what I've done is correct? I view a pom.xml file that has been created so what are the target folder and classes,test-classes subfolders used for? Thanks
If you have the m2eclipse plugin installed you can open your pom in Eclipse and click on the Dependency Hierarchy tab to view your resolved dependencies. You should manage all dependencies through Maven with the setup you are describing.
If you want to check command line you may want to look at using Effective Pom.
If you use m2e, it adds Maven Dependencies pseudo library to your project.
You may expand it and see if the dependent jar file is in there.
If it is, Eclipse ( or more precisely m2e ) has resolved the dependency correctly and it's available for you project build.
If you added your dependencies correctly your application should build and execute correctly, or am I missing something? Dependencies should be added to a POM section that looks like this example:
<dependencies>
<dependency>
<groupId>annogen</groupId>
<artifactId>annogen</artifactId>
<version>0.1.0</version>
</dependency>
<!-- other dependencies here -->
</dependencies>
Maven and the m2e/m2eclipse plugin rely on source files to be conventionally placed in src/main/java for application code and src/test/java for test code. Application code is compiled to target/classes and test code is compiled to target/test-classes. If you plan to use Maven and/or m2e/m2eclipse, do read about it. Maven: The Complete Reference is a good starting point.