STM32CubeIDE: What is the correct method to import drivers and middleware from example projects to the current project? - eclipse

When we are importing an example project to the STM32CubeIDE, it probably uses .cproject and .project files present in the project directory to import required drivers and middleware. For example, here's a list of source files for an example project import into the IDE:
How can I automatically add the set of sources part of Middleware and Drivers folder above to a new project's .project and .cproject files, so that they are properly added to the build configuration?

Related

Diffrence between importing an existing project into Eclipse VS adding a dependency

I need you help understanding nub stuff
What is the Difference between
1. Importing and existing project into Eclipse
2. Adding a dependency ?
The "difference" is that those two are completely different things.
If you import projects into the workspace, you can edit them. For example, you could create a project with Maven, generate Eclipse project files and then import it into Eclipse, or checkout an existing project from SVN or Git am import that one. You can not edit individual files in Eclipse; everything has to be part of a project.
If you add a dependency, you can use the things defined in that dependency in another project. Usually, that dependency would be a JAR file. You can add individual JAR files manually, or use other Programs like Maven aggregate the dependencies and add them to the project.
Also, you can add a project from the workspace as a dependency to another project (after importing both into the workspace). Compared to adding a JAR file as a dependency, this has the advantage that you can edit the one project and the changes will imediately be reflected in the second project that depends on the first one. This makes development much easier than generating a new JAR file from that project every time something changes.

Getting imported files from sample java program to new program

I'm trying to make a small java program revolving around Google Calendars. I've never worked with java before but I was able to get Google's sample code working. In Eclipse, I simply used Import -> Maven, and then made some small changes to the code so that it worked on my Calendar.
Ok, great, now I want to write my own code. I started a new project and imported the Google Calendar API. At the very beginning, there are several import actions:
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp;
import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow;
.
.
.
It turns out that I'm missing the second and third files. How do I find these files and how to do import them to the new project?
Please note: I ultimately don't want to rely on importing the Google Calendar API or anything similar, as I will be using another non-java program to run and control this one.
Here's what I tried:
I go back to the sample code, expand Maven Dependencies and find:
google-oauth-client-jetty-1.19.0.jar
google-oauth-client-java6-1.19.0.jar
I see that these files are in:
C:\******\.m2\repository\com\google\oauth-client\google-oauth-client-jetty\1.19.0
C:\******\.m2\repository\com\google\oauth-client\google-oauth-client-java6\1.19.0
I tried to add these with Import -> Java EE -> App Client JAR file
Didn't work, do I need to change the file name or import name? Maybe these aren't the correct files anyway.
I also tried to add these by creating a lib folder in my project folder and add the JAR files directly there.
I guess from your question your project is just an Eclipse project rather than a Maven project. Obviously Maven automatically add the required jars of the dependencies stated in pom.xml for example google-oauth-client-java6-1.19.0.jar is a dependency of google-oauth-client-jetty-1.19.0.jar.
To add external jar to your project in Eclipse you need to select the project then from the Project menu select Properties. On the properties popup click on the Java Build Path, you have two options depending where the jars are stored, if you are referring to the maven .m2 directory then choose 'Add External Jars' otherwise if you added them to a lib folder in the project choose Add Jars

How to import or extend existing CRS (CommerceReferenceStore) project into eclipse

I have successfully installed ATG10.2 and deployed CRS using CIM.
Now i want to import CRS Project into eclipse.
But i am unable to import it.
Please help me to import into eclipse (elipse ATG Plugin already installed).
This is a common tweak, I use it. If you are able to create a new ATG web module then you would be able to do this too.
Create a test application from your atg plugin, and copy its .classpath and .project files to the CommerceReferenceStore Folder under ATG root directory, don't forget to change the name of the project in the .project file. You can change the classpath after importing the project to eclipse.
then go to eclipse and import an already existing project (without using atg plugin), you are good to go.
If you want to get the individual modules as projects, add these two files to the individual modules and import them to eclipse.
Hope this helps!
Install the Eclipse plugin from %DYNAMO_ROOT%\Eclipse folder. Then add new exusting ATG project.

self-describing project in Eclipse using m2e

I'm using Eclipse and m2e to import a Maven project into Eclipse.
The eclipse documentation states the following about the .project file:
The purpose of this file is to make the project self-describing,
so that a project that is zipped up or released to a server can be
correctly recreated in another workspace.
However, the .project file does not contain no information about the imported Java files nor the pom.xml. It only contains some build commands and natures. Thus, I don't understand how it makes the project self-describing.
It seems that each developer that downloads repository for the first time will need to import the Maven project inside Eclipse again. I'd like to have a meta file that contained at least the pom.xml path so that developers could have a ready environment after downloading the repository content and didn't need to import the Maven project into Eclipse. Is that possible?
Technically speaking, Eclipse doesn't know anything about maven. The .project file is Eclipse's way of storing metadata about the project in a file that's contained within the project (although nowadays some of that metadata has moved to the manifest.MF file). The .project file still contains information about natures (which are used by tools to identify which projects are of interest to the tools) and builders (which describe what tools to invoke as resources in the project are changed). In this way the .project makes the project self describing.
Maven is a relative newcomer (albeit a stable and well-established one) to the Eclipse world. As you point out maven stores all of its project info in a pom.xml file. Maven fits itself into the Eclipse world by providing two actions, "Update Project Configuration" and "Update Project Dependencies", that take the information in the pom.xml file and update the contents of the .project and .classpath files.
So instead of manually editing the .project and .classpath files as you suggest, a developer only has to invoke those two functions after extracting an Eclipse project from a repository.

How to create .classpath and .project files to make a project compatible with Eclipse Helios?

I am having a Java Web project with some class files, JSP files along with WEB-INF and META-INF folders. I want to use this project in Eclipse Helios.
For this I will need to import this project. However, Eclipse will search for .classpath and .project files in the root directory of the project. And unfortunately, I don't have these.
So, can I create one from the project?
Or do I just have to create one project and copy the files into the project? Though this will be a little tedious task if I have too many packages and class files.
Or do I just have to create one project and copy the files into the
project? Though this will be a little tedious task if I have too many
packages and class files.
It isn't tedious. Just create a blank Dynamic Web Project in Eclipse and copy the source folder. You can add a "Source Folder" to point to where your Java source files are present. It will then automatically add all the packages under it.