Pages

Thursday, 24 July 2014

How do we add the jars to the class path ussing maven ?

http://maven.apache.org/plugins/maven-dependency-plugin/
http://stackoverflow.com/questions/4687609/maven-not-setting-classpath-for-dependencies-properly
http://maven.apache.org/plugins/maven-dependency-plugin/



<build>
        <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>/User/sayghosh/code/CCMatching/lib/</outputDirectory>
                        <overWriteReleases>false</overWriteReleases>
                        <overWriteSnapshots>false</overWriteSnapshots>
                        <overWriteIfNewer>true</overWriteIfNewer>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix></classpathPrefix>
                        <mainClass><com.sd.sd.sd></mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        </plugins>

        </build>

What is M2_REPO and what does mvn:eclipse eclipse do ?

First step is to be able to create a pom.xml, then you have to be able to get mvn:compile and mvn:package running. After that comes your eclipse repo the dev environment, in this page you get that running. Next how do you add jars to the classpath to get the jar running. 

  1. M2_REPO is a variable that defines where maven 2 repository is on your disk
  2. This means: add definition of M2_REPO to XML file that defines the eclipse workspace
  3. You can do the same manually if you want. That is what I personally did. Just go to Window/Preferences and then choose Java/Build Path/Classpath Variables. Once you did it you can enjoy maven integration with eclipse. Every time you add new dependency to your pom.xml, run
    mvn eclipse:eclipse
and refresh you workspace you get all new libraries into classpath of your project.
If you have a simple java project which is made up of only one module, using eclipse is very simple. To generate the eclipse project files from your POM you execute the following command:
mvn eclipse:eclipse
If you have created or checked out the project with eclipse, you only have to refresh the project in your workspace. Otherwise you have to import the project into your eclipse workspace (From the menu bar, select File >Import >Existing Projects into Workspace). In the latter case the project (directory) should not be located in your workspace, because eclipse might come into trouble, especially if you want to use eclipse as the scm client.

http://stackoverflow.com/questions/4517507/setting-up-m2-repo-classpath
http://maven.apache.org/guides/mini/guide-ide-eclipse.html

No projects found to import error in eclipse

http://stackoverflow.com/questions/2638016/why-no-projects-found-to-import

Wednesday, 23 July 2014

How would you change your git repository when your location on the server has changed ?


Introduction :
  1. What is remote ? Remote repositories are versions of your project that are hosted on the Internet or network somewhere
  2. What is origin ? If you’ve cloned your repository, you should at least see origin — that is the default name Git gives to the server you cloned from
  3. What does git remote do ? To see which remote servers you have configured, you can run the git remote command. It lists the shortnames of each remote handle you’ve specified.
How to :
  1. git remote rm origin //this will remove the previous origin
  2. git remote add origin <new url location> //this will add the new location on github as the remote
References : 

How to read a WSDL ?

Tuesday, 22 July 2014

Must have eclipse pluggins for Java

  1. Java source attacher : This pluggin allows you to search the source file and attach it to the jar file. Link Download URL
  2. Reference : http://stackoverflow.com/questions/122160/is-there-an-easy-way-to-attach-source-in-eclipse
  3.  
  4. sd
  5. sd
  6.  

Appender hasnt been setup so log4j hasnt been properly initialized

  1. The problem is that the log4j.properties file isn't included in the classpath (it's in the same folder as your Eclipse build path, but Eclipse doesn't have it in its “runtime classpath”.
  2. To add the log4j.properties file to the Eclipse classpath, click on the Run menu and select the Run Configurations option. Select the Classpath tab. Left-click on the “User Entries” item and then select the Advanced … option. Click the Add External Folder option and then click OK button. Navigate to the folder where you unzipped the crawler4j-x.x zip file and select it.
  3. https://code.google.com/p/crawler4j/wiki/StepByStepTutorial