How To Launch Spring In Action Third Source Code Release

I extracted the sia3-code ZIP file and imported the extracted sia3-code folder as Existing Maven projects in my Eclipse Helios IDE . It imported just fine, but I don’t see any of the src in the build path, and I can not run the test classes.

Here's what it looks like: enter image description here

Can someone help me with how to get the source code that comes with the book running as a maven project?

Thanks.

+6
source share
2 answers

1] upload the source code to a directory that I will call code_dir_tree

2] edit pom.xml in the root of code_dir_tree as follows:

replace:

<modules> <module>translators</module> </modules> 

from:

 <modules> <module>knights</module> <module>rest-client</module> <module>springidol</module> <module>springidol-annotation</module> <module>springidol-aop</module> <module>springidol-aspectj</module> <module>springidol-atinject</module> <module>springidol-autodiscovery</module> <module>springidol-javaconfig</module> <module>springidol-qualifiers</module> </modules> 

3] from a command shell in the root directory of code_dir_tree, run: mvn eclipse: clean

4] within eclipse, make sure you have an updated, preferably free workspace

5] copy the entire dir_tree code manually to the workspace - not separate projects, the dir_tree code itself.

6] in eclipse, import | existing maven projects, select the root code code_dir_tree (already in the workspace), make sure that all projects, including pom.xml, are selected, click the chip

7] run maven updates, clean installation builds - all -maven- projects, except for the rest of the client, which has an unresolved dependency, should now be ready to go

The rest of the projects, spitter and SpringPizza are gradle projects - STS, which has a gradle integrator, needs to be installed to get these imported

8] in eclipse, import | gradle project, select the merge directory, click ok, select "build model" when everything is complete, all are selected, click "Finish"

9] repeat the same process as in 8] for SpringPizza

For this to happen - you must be ready to go!

+3
source

In the package explorer, right-click the java directory and select "Create Path-> Use as Source Folder". Do this for both java directories (in src / main and in src / tst).

Then right-click on the project and select "Configure-> Convert to Maven Project".

UPDATE:

I think you need to install M2Eclipse Plugin. Below are some guidelines . Then you can right-click on your project and select Maven-> Enable Dependency Management.

Since you are using Spring, I highly recommend you check out the SpringSource Tool Suite. This is Eclipse complete with many useful plugins (e.g. m2eclipse). Here is a short snippet from their site:

Spring Tool Suite β„’ (STS) provides the best Eclipse-based development environment for building enterprise Spring applications. STS provides tools for all of the latest enterprise Java and Spring and is among the latest releases of Eclipse.

Read about STS and upload it to your website: http://www.springsource.org/sts

SECOND UPDATE:

I think I see what you did wrong. It looks like you indicated the root of your project as a directory containing the 'sia3-code' folder. This has led to the collapse of all projects within one major project, which, I am sure, is not the way you want to do it.

Remove the project from your Eclipse. Then, in the Package Explorer, right-click and select Import. Select Existing Projects in the Workspace. Select the root directory, which will be / your / path / to / sia3-code / (do not select the root directory for / your / path / to /). Then select Done. You will see that you have 10+ projects imported into your IDE.

The above steps have been tested in STS, so you may need to adapt them a bit if you use Eclipse Helios.

+1
source

Source: https://habr.com/ru/post/926243/


All Articles