The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

phillips1021 (66) [Avatar] Offline
#1
Purchased the book.

Downloaded the source code on June 19 2011

Unzipped the download. It looks like some of the examples are Eclipse projects while others are not. The examples are organized in the Maven way, but some are missing the pom.xml

Tried to run the springidol-annotation example's test and get test failures.

Cannot figure out how to run the spitter-persistence-jpa test - it looks like the pom.xml is missing.

Very disappointed with the quality of the source code.
jacob85 (1) [Avatar] Offline
#2
Re: Source Code Problems
did you try to use command line and enter a extracted source folder like knights?

1.run command line (or terminal if you use linux/unix)
2.use cd kinghts (or the path which the folder is)
3.mvn eclipse:eclipse

and then use STS and import the folder as "Existing Projects into Workspace"
that should work!

it only didn't work for one project. I will check it later .
ranajit (13) [Avatar] Offline
#3
Re: Source Code Problems
Please let me know if you are able to resolve the issues.

1. the STS is what we used.
2. did you import the project or created the project ?
3. any environment variable to be set ?
4. all the classpath could be resolved with maven dependencies ?

Please share your finding . thank you for your help
ranajit (13) [Avatar] Offline
#4
Re: Source Code Problems
Hi All,

This was surely a bumpy ride. Need to know Maven and Gradle.

Spittle is done in gradle and thus have multiple projects in Gradle.
others are done in Maven.

1. i used STS.
2. hit "maven archetype:generate". it gets lots of plugin into your machine repository
3. hit "maven eclipse:eclipse" and this to gets eclipse plugins
most of the maven dependencies are resolved by this. still if you see the error go to your maven directory and delete the folder and clean and build the project, most of the time the jars will be downloaded in the repository automatically.
4. gradle is next step , hit "gradle buildDependents" and it will get the gradle repository into your local machine..

I am still not able to resolve the classpath issue of the project as it is talking the base directory as the directory of the src location and not the repository. I tried a lot to fix it but later gave in and manually set the classpath.
ranajit (13) [Avatar] Offline
#5
Re: Source Code Problems
Something more . i went into the folder which contained Spitter and ran
>gradle install
>gradle cleanEclipse eclipse

errors seems to have been resolved by this.

some of the projects i still had to import
1. spitter-web
2.spitter-service-annotation-tx
3.spitter-service-common.

and some more
1. spitter-domain-jpa
2. forgot some. may be more... just import the projects into eclipse

I faced some problem as the static import didnot work
thus import static org.mockito.Mockito.*; did not work
you can use import org.mockito.*; and change the methods to Mockito.mock etc

the source code looks clean now. All, this has been stuggle but I learnt Maven and gradle in this process. Overall took almost 6 days (totally may be 20 hours) + reading time for Maven and Gradle , and lot of trial and error.
samr251 (2) [Avatar] Offline
#6
Re: Source Code Problems
Hi All,
I am facing same problem, any one can explain it step by step for running this code examples.
dmc7337 (1) [Avatar] Offline
#7
Re: Source Code Problems
There is a problem with the parent pom.xml file in the root directory of the sample code. The list of modules is wrong. The version I downloaded was:
<modules>
<module>translator</module>
</modules>

I changed this to include the maven modules in the sample code. It is then :

<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>

Then in the sample code directory you should be able to run:
mvn eclipse:clean
without error.

Then in eclipse import as an existing maven project and select the root directory as the base. The maven eclipse plugin should then work out the relationship between the parent a pom and the modules and with a number of maven projects being created.

Can't help with Splitter and SpringPizza as they are gradle projects.
theRiley (1) [Avatar] Offline
#8
Re: Source Code Problems
elaborating on dmc's remarks, here is what i hope is an end-to-end process that will work for you:

1] download the sourcecode into a dir, which i'll refer to as code_dir_tree

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

replace:

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

with:

<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 code_dir_tree root directory, run: mvn eclipse:clean

4] within eclipse, ensure you have a refreshed, preferably empty workspace available

5] copy the entire code_dir_tree manually into the workspace - not the individual projects, the code_dir_tree itself.

6] in eclipse, perform import | existing maven projects, select the code_dir_tree root (already within the workspace), ensure all the projects including the pom.xml are selected, hit finish

7] run maven updates, clean install builds - all -maven- projects aside from rest-client, which has an unresolved dependency, should now be ready to go

The remaining projects, spitter and SpringPizza, are gradle projects - STS, which has gradle integraton, needs to be installed to get these imported

8] in eclipse, perform import | gradle project, select the spitter directory, hit ok, select 'build model', when complete ensure all are selected, hit finish

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

10] to create targets for the gradle projects, first run the build model on the individual projects - this will create targets for you to clean/install/deploy, etc.

That's it - you should be ready to roll!