Eclipse Tycho change default source location - eclipse

I am trying to build eclipse plugin using Tycho, eventhough we are using maven, our project structure is bit different than standard tycho/maven structure. (because due to company standards)
Project structure is as shown below:
com.test.plugin
|
------ build
-------|
-------------plugin-artifacts
-------------|classes //compiled classes
-------------|META-INF
//here folder structure is bit different, pom.xml inside build directory
will take care of generating plugin-artifacts.
So my question is , is it possible to specify tycho to take build/plugin-artifacts as root directory to generate plugin jar file, instead of taking com.test.plugin as root?
I am following Lars Vogel's tutorial to learn tycho plugin.

Tycho doesn't allow to configure where the OSGi manifest is located. It always has to be at META-INF/MANIFEST.MF relative to the pom.xml file.
Most other input and output folders are configurable though, so you could simply put the pom.xml at com.test.plugin/build/plugin-artifacts, and configure the paths in the build.properties (located in the same folder as the pom.xml) and POM.

Related

netbeans web.xml file is same as pom.xml file in eclipse?

Am a beginner with netbeans IDE. I want to know that web.xml file in Netbeans hierarchy is same as that of pom.xml file in Eclipse IDE.
Where as in Eclipse, when we create a project it comes with pom.xml file. We can modify when we need to modify or to add dependencies. So, how about in Netbeans? web.xml work as similar to pom.xml
I think you got this all wrong. Please read through some materials.
web.xml - deployment descriptor
Java web applications use a deployment descriptor file to determine how URLs map to servlets, which URLs require authentication, and other information. This file is named web.xml, and resides in the app's WAR under the WEB-INF/ directory. web.xml is part of the servlet standard for web applications.
A web application's deployment descriptor describes the classes, resources and configuration of the application and how the web server uses them to serve web requests. When the web server receives a request for the application, it uses the deployment descriptor to map the URL of the request to the code that ought to handle the request.
pom.xml - project object model
A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects. Examples for this is the build directory, which is target; the source directory, which is src/main/java; the test source directory, which is src/test/java; and so on.
The POM was renamed from project.xml in Maven 1 to pom.xml in Maven 2. Instead of having a maven.xml file that contains the goals that can be executed, the goals or plugins are now configured in the pom.xml. When executing a task or goal, Maven looks for the POM in the current directory. It reads the POM, gets the needed configuration information, then executes the goal.
Some of the configuration that can be specified in the POM are the project dependencies, the plugins or goals that can be executed, the build profiles, and so on. Other information such as the project version, description, developers, mailing lists and such can also be specified.
Go through the below pages.
https://maven.apache.org/guides/introduction/introduction-to-the-pom.html
https://cloud.google.com/appengine/docs/java/config/webxml

class test in an existing project j2ee converted to maven project

I'm a beginner in Maven and i have to "mavenize" an existing project for a company.
I opened the project in Eclipse and right click on the project -> Configure -> Convert to Maven Project.
So after that I didn't get the folders : src/main/java, src/main/resources, src/test/java, src/test/resources. I didn't get anything.
I have the m2e plugin and also Maven 3.3.3
I get the lib and Maven Dependency and arrange the pom.xml but i didn't have any test folder and any class Test so when running mvn:test i get no tests to run.
My question is : I have to create all the classTest manually ? Or Maven is supposed to create them automatically ?
Convert to Maven would normally:
configure the Maven Compile Plugin according to the JDK version in use by the original project
configure the build/sourceDirectory element (normally to src) instead of the standard src/main/java
ignore the bin folder used by default by Eclipse (so may see it in the Package Explorer and you can safely delete it)
Some manual steps are required (and suggested):
move the code to a newly created src/main/java folder and remove the build/sourceDirectory customization
remove the bin directory (it will now be target/classes)
Create src/main/resources folder and move any required resource (configuration file, etc.) to this folder
place your test sources under src/test/java, which you also need to create
if not the case, rename any test class to end by the *Test or *TestCase suffix so that by default the Maven Surefire Plugin will pick them up automatically (if not possible, alternatively you would need to configure it as described via official documentation here
If you don't have any test class yet, of course Maven would never create them automatically, you are responsible of writing your test cases, Maven would only run them.

Exclude Ivy Dependencies in WAR File

I use Eclipse and the Ivy plugin IvyDE.
I currently create a WAR file by using Eclipse's export to WAR functionality. I don't use an ANT build file - I let Eclipse handle that.
When I export to war, all the dependencies in the ivy.xml file get copied to the war file's bin directory. I want to exclude one (or more) of them. How do I do that?
What't the simplest way to accomplish this? If possible, I would like to avoid creating my own ANT build files and continue to use Eclipse's export tool and the IvyDE plugin.
For me the following did the trick:
copy the ivy.xml to e.g. ivy-nodeploy.xml
create/select the configurations you want to include in the deployment assembly in ivy.xml
create/select the configurations you don't want to include in the deployment assembly in ivy-nodeploy.xml
add a new ivy-library to the build path where you change the default ivy-filename to
ivy-nodeploy.xml
That way you still have all ivy managed libraries at compile time in your build path but only libraries configured in ivy.xml get included in the war file.
Right click on your project's ivy.xml, and choose "Add ivy library".
In the main tab are customization settings for the build configs, and it looks as though you can choose the conf you desire (i.e. set it to runtime). I war using Ant, so I've never tried it. I presume this will accomplish what you desire.

scala generating jar file from scala-io to include in eclipse

I am trying to use the library scala-io in my Eclipse environment, does anyone know how do I generate a jar file, or which folder to include in my eclipse so that I can have access to the scala-io library from my project ?
EDIT:
Q: How to incorporate an external library into scala IDE?
A: Two possibilities:
Leverage SBT to build your project; that is generating jar files and maintaining dependency
Including the generted jar files directory in the IDE, project -> Properties -> Java build paths.
hth.
EDIT #2:
I found this great plugin to generate all of your dependencies in one jar file sbt-assembly
http://jesseeichar.github.io/scala-io-doc/0.4.2/index.html#!/getting-started
shows how to start with sbt or maven or with prebuild jars provided by links.
You should try to get familiar with a build system like sbt. Its cumbersome to always manually add dependencies to eclipse, especially if you have dependency chains: scala-io needs scala-io-core and arm and file etc...

Eclipse build path: library with native library folder

I created an Eclipse project and I need to use the Super CSV library with Dozer. I downloaded the Super CSV and created a new folder "super-csv" in /usr/lib.
Now I have: /usr/lib/super-csv/super-csv that contains the super csv jar (+ javadoc and source),
/usr/lib/super-csv/super-csv-dozer that contains the super csv dozer jar, javadoc and source plus a "lib" folder.
Inside /usr/lib/super-csv/super-csv-dozer/lib there are many .jar files that are needed for super-csv-dozer to work, so I added it as native library for super-csv-dozer entry in library tab of java build path in Eclipse.
When I try to compile the project, I receive a java.lang.ClassNotFoundException pointing a class that is contained in one of the jar files in the lib folder.
Everything works only if I manually add every jar in lib folder as an external jar.
Can someone explain me where I am doing wrong?
I'd recommend using Maven - it's a widely used tool for Java builds. To start using Super CSV, it would be as simple as adding the 2 dependencies (listed on the Super CSV website), and your Eclipse project would be ready to go.
There's a bit of a learning curve though, so if you want to just add the jars to Eclipse's build path manually, I'd recommend creating a lib directory at the root of your project and putting all of the jars there.
my-project
|-src
| |- (your source in here)
|
|-lib
|-commons-beanutils-1.8.3.jar
|-commons-lang-2.5.jar
|-commons-logging-1.1.1.jar
|-dozer-5.3.2.jar
|-slf4j-api-1.7.1.jar
|-super-csv-2.0.1.jar
|-super-csv-dozer-2.0.1.jar
You can then add them to the build path (here's a good guide).
Just a note: if you're not using the Dozer extension, then you'll only need super-csv-2.0.1.jar on the build path.